Specification of a valid Ensight file-name. More...
#include <ensightFileName.H>


Public Member Functions | |
| FileName (const FileName &)=default | |
| Copy construct. | |
| FileName (FileName &&)=default | |
| Move construct. | |
| FileName (const char *s) | |
| Construct as copy of character array. | |
| FileName (const std::string &s) | |
| Copy construct from std::string. | |
| FileName (std::string &&s) | |
| Move construct from std::string. | |
| void | stripInvalid () |
| Strip invalid characters. | |
| void | operator= (const fileName &)=delete |
| void | operator= (const word &)=delete |
| void | operator= (const string &)=delete |
| void | operator= (const std::string &)=delete |
| void | operator= (const char *)=delete |
| Public Member Functions inherited from fileName | |
| fileName ()=default | |
| Default construct. | |
| fileName (const fileName &)=default | |
| Copy construct. | |
| fileName (fileName &&)=default | |
| Move construct. | |
| fileName (const word &s) | |
| Copy construct from word. | |
| fileName (word &&s) | |
| Move construct from word. | |
| fileName (const string &s, bool doStrip=true) | |
| Copy construct from string. | |
| fileName (string &&s, bool doStrip=true) | |
| Move construct from string. | |
| fileName (const std::string &s, bool doStrip=true) | |
| Copy construct from std::string. | |
| fileName (std::string &&s, bool doStrip=true) | |
| Move construct from std::string. | |
| fileName (const char *s, bool doStrip=true) | |
| Copy construct from character array. | |
| fileName (const UList< word > &list) | |
| Construct by concatenating elements of wordList separated by '/'. | |
| fileName (std::initializer_list< word > list) | |
| Construct by concatenating words separated by '/'. | |
| fileName (Istream &is) | |
| Construct from Istream. | |
| bool | assign (const token &tok) |
| Assign from word or string token. | |
| void | stripInvalid () |
| Strip invalid characters. | |
| bool | clean () |
| Cleanup filename (inplace). | |
| Type | type (bool followLink=true, bool checkGzip=false) const |
| Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK). | |
| bool | isAbsolute () const |
| Return true if filename is absolute, which means it starts with a '/' or '\' or (windows-only) with a filesystem-root. | |
| fileName & | toAbsolute () |
| Convert from relative to absolute. | |
| bool | isBackup () const |
| Return true if file name ends with "~", ".bak", ".old", ".save". | |
| fileName | path () const |
| Return directory path name (part before last /). | |
| bool | has_path () const |
| True if it contains a '/' character. | |
| word | name () const |
| Return basename (part beyond last /), including its extension. | |
| fileName & | replace_name (const word &newName) |
| Replace basename (part beyond last /) with a new name. | |
| word | stem () const |
| Return basename, without extension. | |
| word | ext () const |
| Return file name extension (part after last .). | |
| fileName & | ext (const word &ending) |
| Append a '.' and the ending, and return the object. | |
| fileName & | replace_ext (const word &ending) |
| Remove extension (if any) and append a new one. | |
| fileName | lessExt () const |
| Return file name without extension (part before last .). | |
| fileName | relative (const fileName &parent, const bool caseTag=false) const |
| Return a relative name by stripping off the parent directory where possible. | |
| wordList | components (const char delim='/') const |
| Return path components as wordList. | |
| word | component (const size_type cmpt, const char delim='/') const |
| Return a single component of the path or empty if out of range. | |
| fileName & | operator= (const fileName &str) |
| Copy assignment, no character validation required. | |
| fileName & | operator= (fileName &&str) |
| Move assignment, no character validation required. | |
| fileName & | operator= (const word &str) |
| Copy assignment, no character validation required. | |
| fileName & | operator= (word &&str) |
| Move assignment, no character validation required. | |
| fileName & | operator= (const string &str) |
| Copy assignment, stripping invalid characters. | |
| fileName & | operator= (string &&str) |
| Move assignment, stripping invalid characters. | |
| fileName & | operator= (const std::string &str) |
| Copy assignment, stripping invalid characters. | |
| fileName & | operator= (std::string &&str) |
| Move assignment, stripping invalid characters. | |
| fileName & | operator= (const char *str) |
| Copy, stripping invalid characters. | |
| fileName & | operator/= (const string &other) |
| Append a path element with '/' separator. | |
| bool | hasPath () const |
| Same as has_path(). | |
| bool | removePath () |
| Same as remove_path(). | |
| bool | hasExt () const |
| Same as has_ext(). | |
| bool | hasExt (const std::string &s) const |
| Same as has_ext(). | |
| bool | removeExt () |
| Same as remove_ext(). | |
| word | nameLessExt () const |
| Same as stem(). | |
| word | name (const bool noExt) const |
| Deprecated(2017-03) return basename, optionally without extension. | |
| bool | remove_path () |
| Remove leading path, return true if string changed. | |
| bool | remove_ext () |
| Remove extension, returning true if string changed. | |
| bool | has_ext () const |
| Various checks for extensions. | |
| bool | has_ext (const char *ending) const |
| Various checks for extensions. | |
| bool | has_ext (const std::string &ending) const |
| Various checks for extensions. | |
| bool | has_ext (const wordRe &ending) const |
| Various checks for extensions. | |
| Public Member Functions inherited from string | |
| string ()=default | |
| Default construct. | |
| string (const std::string &str) | |
| Copy construct from std::string. | |
| string (std::string &&str) | |
| Move construct from std::string. | |
| string (const char *str) | |
| Construct as copy of character array. | |
| string (const char *str, const size_type len) | |
| Construct as copy with a maximum number of characters. | |
| string (const char c) | |
| Construct from a single character. | |
| string (const size_type len, const char c) | |
| Construct fill copies of a single character. | |
| string (Istream &is) | |
| Construct from Istream. | |
| bool | match (const std::string &text) const |
| Test for equality. | |
| string & | replace (const std::string &s1, const std::string &s2, size_type pos=0) |
| Replace first occurrence of sub-string s1 with s2, beginning at pos. | |
| string & | replaceAll (const std::string &s1, const std::string &s2, size_type pos=0) |
| Replace all occurrences of sub-string s1 with s2, beginning at pos in the string. | |
| string & | replaceAny (const std::string &s1, const char c2, size_type pos=0) |
| Replace any occurrence of s1 characters with c2, beginning at pos in the string. | |
| string & | expand (const bool allowEmpty=false) |
| Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::expand. | |
| bool | removeRepeated (const char character) |
| Remove repeated characters. | |
| bool | removeStart (const std::string &text) |
| Remove the given text from the start of the string. | |
| bool | removeStart (const char c) |
| Remove leading character, unless string is a single character. | |
| bool | removeEnd (const std::string &text) |
| Remove the given text from the end of the string. | |
| bool | removeEnd (const char c) |
| Remove trailing character, unless string is a single character. | |
| void | swap (std::string &str) |
| Swap contents. Self-swapping is a no-op. | |
| bool | operator() (const std::string &text) const |
| Test for equality. Allows use as a predicate. | |
| bool | contains (char c) const noexcept |
| True if string contains given character (cf. C++23). | |
| bool | contains (const std::string &s) const noexcept |
| True if string contains given [string view] substring (cf. C++23). | |
| bool | contains (const char *s) const |
| True if string contains given substring (cf. C++23). | |
| bool | starts_with (char c) const |
| True if string starts with given character (cf. C++20). | |
| bool | starts_with (const std::string &s) const |
| True if string starts with given [string view] prefix (C++20). | |
| bool | starts_with (const char *s) const |
| True if string starts with given prefix (C++20). | |
| bool | ends_with (char c) const |
| True if string ends with given character (cf. C++20). | |
| bool | ends_with (const std::string &s) const |
| True if string ends with given [string view] suffix (cf. C++20). | |
| bool | ends_with (const char *s) const |
| True if string ends with given suffix (cf. C++20). | |
| size_type | count (const char c) const |
| Count the number of occurrences of the specified character in the string. | |
| bool | startsWith (const std::string &s) const |
| Deprecated(2019-11). | |
| bool | endsWith (const std::string &s) const |
| Deprecated(2019-11). | |
| bool | removeTrailing (const char c) |
| Deprecated(2019-11). | |
Static Public Member Functions | |
| static bool | valid (char c) |
| Is this character valid for an ensight file-name. | |
| Static Public Member Functions inherited from fileName | |
| static bool | valid (char c) |
| Is this character valid for a fileName? | |
| static fileName | validate (const std::string &, const bool doClean=true) |
| Construct fileName without invalid characters, possibly applying other transformations such as changing the path separator, removing duplicate or trailing slashes, etc. | |
| static fileName | concat (const std::string &s1, const std::string &s2, const char delim='/') |
| Join two strings with a path separator ('/' by default). | |
| static bool | equals (const std::string &s1, const std::string &s2) |
| This is a specialized (possibly slower) version of compare() that ignores duplicate or trailing slashes. | |
| static bool | clean (std::string &str) |
| Cleanup filename string, possibly applies other transformations such as changing the path separator etc. | |
| static bool | isAbsolute (const std::string &str) |
| Return true if filename starts with a '/' or '\' or (windows-only) with a filesystem-root. | |
| static bool | isBackup (const std::string &str) |
| Return true if string ends with "~", ".bak", ".old", ".save". | |
| static std::string | path (const std::string &str) |
| Return directory path name (part before last /). | |
| static std::string | name (const std::string &str) |
| Return basename (part beyond last /), including its extension. | |
| static std::string | stem (const std::string &str) |
| Return the basename, without extension. | |
| static std::string | nameLessExt (const std::string &s) |
| Same as stem(). | |
| Static Public Member Functions inherited from string | |
| static std::string::size_type | length (const char *s) |
| Length of the character sequence (with nullptr protection). | |
| static std::string::size_type | length (const std::string &s) |
| The length of the string. | |
| template<class StringType> | |
| static bool | valid (const std::string &str) |
| Does the string contain valid characters only? | |
| template<class StringType> | |
| static bool | stripInvalid (std::string &str) |
| Strip invalid characters from the given string. | |
| template<class StringType> | |
| static StringType | validate (const std::string &str) |
| Return a valid String from the given string. | |
Additional Inherited Members | |
| Public Types inherited from fileName | |
| enum | Type { UNDEFINED = 0 , FILE = 1 , DIRECTORY = 2 , SYMLINK = 4 , LINK = SYMLINK } |
| Enumerations to handle directory entry types. More... | |
| Static Public Attributes inherited from fileName | |
| static const char *const | typeName = "fileName" |
| The typeName. | |
| static int | debug |
| Debugging. | |
| static int | allowSpaceInFileName |
| Allow space character in fileName. To be used with caution. | |
| static const fileName | null |
| An empty fileName. | |
| Static Public Attributes inherited from string | |
| static const char *const | typeName = "string" |
| The type name "string". | |
| static int | debug |
| The debug flag. | |
| static const string | null |
| An empty string. | |
| Protected Member Functions inherited from string | |
| std::string::size_type | find_ext () const |
| Find position of a file extension dot, return npos on failure. | |
| word | ext () const |
| Return file name extension (part after last .). | |
| bool | ext (const word &ending) |
| Append a '.' and the ending. | |
| bool | has_ext () const |
| Return true if it has an extension or simply ends with a '.'. | |
| bool | has_ext (const char *ending) const |
| Return true if the extension is the same as the given ending. | |
| bool | has_ext (const std::string &ending) const |
| Return true if the extension is the same as the given ending. | |
| bool | has_ext (const wordRe &ending) const |
| Return true if the extension matches the given ending. | |
| bool | remove_path () |
| Remove leading path, return true if string changed. | |
| bool | remove_ext () |
| Remove extension, return true if string changed. | |
| Static Protected Member Functions inherited from string | |
| static std::string::size_type | find_ext (const std::string &str) |
| Find position of a file extension dot, return npos on failure. | |
| template<class PrimitiveType> | |
| static std::string::size_type | string_printf (std::string &output, const char *fmt, const PrimitiveType &val) |
| A printf-style formatter for a primitive. | |
| template<class PrimitiveType> | |
| static std::string::size_type | string_printf (std::string &output, const std::string &fmt, const PrimitiveType &val) |
| A printf-style formatter for a primitive. | |
Specification of a valid Ensight file-name.
Spaces must be quoted, no '*' wildcards, no '' (structured block continuation).
Overall line length within case file is limited to 1024, but this is not yet addressed.
Definition at line 54 of file ensightFileName.H.
|
default |
Copy construct.
References FileName().
Referenced by FileName(), and FileName().


|
default |
|
inlineexplicit |
Construct as copy of character array.
Definition at line 26 of file ensightFileNameI.H.
References fileName::fileName(), s(), and stripInvalid().

|
inlineexplicit |
Copy construct from std::string.
Definition at line 34 of file ensightFileNameI.H.
References fileName::fileName(), s(), and stripInvalid().

|
inlineexplicit |
Move construct from std::string.
Definition at line 42 of file ensightFileNameI.H.
References fileName::fileName(), s(), and stripInvalid().

|
inlinestatic |
Is this character valid for an ensight file-name.
Definition at line 52 of file ensightFileNameI.H.
References fileName::valid().

|
inline |
Strip invalid characters.
Definition at line 63 of file ensightFileNameI.H.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, string::removeEnd(), string::removeRepeated(), string::replaceAny(), and string::stripInvalid().
Referenced by FileName(), FileName(), and FileName().


|
delete |
|
delete |
|
delete |
|
delete |
|
delete |