VarName Class Reference

Specification of a valid Ensight variable-name. More...

Inheritance diagram for VarName:
[legend]
Collaboration diagram for VarName:
[legend]

Public Member Functions

 VarName (const VarName &)=default
 Copy construct. More...
 
 VarName (VarName &&)=default
 Move construct. More...
 
 VarName (const char *s)
 Construct as copy of character array. More...
 
 VarName (const std::string &s)
 Copy construct from std::string. More...
 
void stripInvalid ()
 Strip invalid characters. More...
 
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 word
 word ()=default
 Default construct. More...
 
 word (const word &)=default
 Copy construct. More...
 
 word (word &&w)=default
 Move construct. More...
 
 word (const string &s, bool doStrip=true)
 Copy construct from Foam::string. More...
 
 word (string &&s, bool doStrip=true)
 Move construct from Foam::string. More...
 
 word (const std::string &s, bool doStrip=true)
 Copy construct from std::string. More...
 
 word (std::string &&s, bool doStrip=true)
 Move construct from std::string. More...
 
 word (const char *s, bool doStrip=true)
 Copy from character array. More...
 
 word (const char *s, size_type len, bool doStrip)
 Copy from buffer for a maximum number of characters. More...
 
 word (Istream &is)
 Construct from Istream. More...
 
void stripInvalid ()
 Strip invalid characters from this word. More...
 
word lessExt () const
 Return word without extension (part before last .) More...
 
word ext () const
 Return file name extension (part after last .) More...
 
wordext (const word &ending)
 Append a '.' and the ending, and return the object. More...
 
wordoperator= (const word &s)
 Copy assignment, no character validation required. More...
 
wordoperator= (word &&s)
 Move assignment, no character validation required. More...
 
wordoperator= (const string &s)
 Copy assignment from Foam::string, stripping invalid characters. More...
 
wordoperator= (string &&s)
 Move assignment from Foam::string, stripping invalid characters. More...
 
wordoperator= (const std::string &s)
 Copy assignment from std::string, stripping invalid characters. More...
 
wordoperator= (std::string &&s)
 Move assignment from std::string, stripping invalid characters. More...
 
wordoperator= (const char *s)
 Copy, stripping invalid characters. More...
 
template<class PrimitiveType >
Foam::word printf (const char *fmt, const PrimitiveType &val)
 
template<class PrimitiveType >
Foam::word printf (const std::string &fmt, const PrimitiveType &val)
 
bool hasExt () const
 Various checks for extensions. More...
 
bool hasExt (const char *ending) const
 Various checks for extensions. More...
 
bool hasExt (const std::string &ending) const
 Various checks for extensions. More...
 
bool hasExt (const wordRe &ending) const
 Various checks for extensions. More...
 
bool removeExt ()
 Remove extension, returning true if string changed. More...
 
- Public Member Functions inherited from string
 string ()=default
 Default construct. More...
 
 string (const std::string &str)
 Copy construct from std::string. More...
 
 string (std::string &&str)
 Move construct from std::string. More...
 
 string (const char *str)
 Construct as copy of character array. More...
 
 string (const char *str, const size_type len)
 Construct as copy with a maximum number of characters. More...
 
 string (const char c)
 Construct from a single character. More...
 
 string (const size_type len, const char c)
 Construct fill copies of a single character. More...
 
 string (Istream &is)
 Construct from Istream. More...
 
bool match (const std::string &text) const
 Test for equality. More...
 
stringreplace (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAll (const std::string &s1, const std::string &s2, size_type pos=0)
 
stringreplaceAny (const std::string &s1, const char c2, size_type pos=0)
 
stringexpand (const bool allowEmpty=false)
 
bool removeRepeated (const char character)
 Remove repeated characters. More...
 
bool removeStart (const std::string &text)
 Remove the given text from the start of the string. More...
 
bool removeStart (const char c)
 Remove leading character, unless string is a single character. More...
 
bool removeEnd (const std::string &text)
 Remove the given text from the end of the string. More...
 
bool removeEnd (const char c)
 Remove trailing character, unless string is a single character. More...
 
void swap (std::string &str)
 Swap contents. Self-swapping is a no-op. More...
 
bool operator() (const std::string &text) const
 Test for equality. Allows use as a predicate. More...
 
bool starts_with (const std::string &s) const
 True if string starts with the given prefix (cf. C++20) More...
 
bool starts_with (const char c) const
 True if string starts with the given character (cf. C++20) More...
 
bool ends_with (const std::string &s) const
 True if string ends with the given suffix (cf. C++20) More...
 
bool ends_with (const char c) const
 True if string ends with the given character (cf. C++20) More...
 
size_type count (const char c) const
 
bool startsWith (const std::string &s) const
 Deprecated(2019-11) More...
 
bool endsWith (const std::string &s) const
 Deprecated(2019-11) More...
 
bool removeTrailing (const char c)
 Deprecated(2019-11) More...
 

Static Public Member Functions

static bool valid (char c)
 Is this character valid for an ensight var-name. More...
 
- Static Public Member Functions inherited from word
template<class PrimitiveType >
static word printf (const char *fmt, const PrimitiveType &val)
 Use a printf-style formatter for a primitive. More...
 
template<class PrimitiveType >
static word printf (const std::string &fmt, const PrimitiveType &val)
 Use a printf-style formatter for a primitive. More...
 
static bool valid (char c)
 Is this character valid for a word? More...
 
static word validate (const std::string &s, const bool prefix=false)
 Construct validated word (no invalid characters). More...
 
static word validate (const char *first, const char *last, const bool prefix=false)
 
- Static Public Member Functions inherited from string
template<class StringType >
static bool valid (const std::string &str)
 Does the string contain valid characters only? More...
 
template<class StringType >
static bool stripInvalid (std::string &str)
 Strip invalid characters from the given string. More...
 
template<class StringType >
static StringType validate (const std::string &str)
 Return a valid String from the given string. More...
 

Additional Inherited Members

- Static Public Attributes inherited from word
static const char *const typeName = "word"
 The typeName. More...
 
static int debug
 Debugging. More...
 
static const word null
 An empty word. More...
 
- Static Public Attributes inherited from string
static const char *const typeName = "string"
 The type name "string". More...
 
static int debug
 The debug flag. More...
 
static const string null
 An empty string. More...
 
- Protected Member Functions inherited from string
std::string::size_type find_ext () const
 Find position of a file extension dot, return npos on failure. More...
 
word ext () const
 Return file name extension (part after last .) More...
 
bool ext (const word &ending)
 Append a '.' and the ending. More...
 
bool hasPath () const
 Return true if it contains a '/' character. More...
 
bool hasExt () const
 Return true if it has an extension or simply ends with a '.'. More...
 
bool hasExt (const char *ending) const
 Return true if the extension is the same as the given ending. More...
 
bool hasExt (const std::string &ending) const
 Return true if the extension is the same as the given ending. More...
 
bool hasExt (const wordRe &ending) const
 Return true if the extension matches the given ending. More...
 
bool removeExt ()
 Remove extension, returning true if string changed. More...
 
bool removePath ()
 Remove leading path, returning true if string changed. More...
 
- 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. More...
 
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. More...
 
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. More...
 

Detailed Description

Specification of a valid Ensight variable-name.

Illegal characters

space !#%()*+,-./;@[]^

If spaces exist, they must be quoted

Variable names cannot start with a digit. The maximum part name length (in GUI: 49 chars) - not addressed. The maximum variable length (in GUI: 49 chars) - not addressed.

Definition at line 59 of file ensightVarName.H.

Constructor & Destructor Documentation

◆ VarName() [1/4]

VarName ( const VarName )
default

Copy construct.

◆ VarName() [2/4]

VarName ( VarName &&  )
default

Move construct.

◆ VarName() [3/4]

VarName ( const char *  s)
inlineexplicit

Construct as copy of character array.

Definition at line 33 of file ensightVarNameI.H.

References VarName::stripInvalid().

Here is the call graph for this function:

◆ VarName() [4/4]

VarName ( const std::string &  s)
inlineexplicit

Copy construct from std::string.

Definition at line 41 of file ensightVarNameI.H.

References VarName::stripInvalid().

Here is the call graph for this function:

Member Function Documentation

◆ valid()

bool valid ( char  c)
inlinestatic

Is this character valid for an ensight var-name.

Definition at line 51 of file ensightVarNameI.H.

References interfaceEntry::valid().

Here is the call graph for this function:

◆ stripInvalid()

void stripInvalid ( )
inline

Strip invalid characters.

Definition at line 74 of file ensightVarNameI.H.

References Foam::exit(), Foam::FatalError, FatalErrorInFunction, insert(), and Foam::nl.

Referenced by VarName::VarName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/4]

void operator= ( const word )
delete

◆ operator=() [2/4]

void operator= ( const string )
delete

◆ operator=() [3/4]

void operator= ( const std::string &  )
delete

◆ operator=() [4/4]

void operator= ( const char *  )
delete

The documentation for this class was generated from the following files: