Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
keyType Class Reference

A class for handling keywords in dictionaries. More...

Inheritance diagram for keyType:
Inheritance graph
[legend]
Collaboration diagram for keyType:
Collaboration graph
[legend]

Public Types

enum  option : unsigned char {
  LITERAL = 0, REGEX = 1, RECURSIVE = 0x80, LITERAL_RECURSIVE = (LITERAL | RECURSIVE),
  REGEX_RECURSIVE = (REGEX | RECURSIVE)
}
 

Public Member Functions

 keyType ()
 
 keyType (const keyType &)=default
 
 keyType (keyType &&)=default
 
 keyType (const word &str)
 
 keyType (word &&str)
 
 keyType (const string &str)
 
 keyType (string &&str)
 
 keyType (const std::string &str, option opt)
 
 keyType (std::string &&str, option opt)
 
 keyType (const char *str, option opt=option::LITERAL)
 
 keyType (Istream &is)
 
bool isLiteral () const noexcept
 
bool isPattern () const noexcept
 
bool assign (const token &tok)
 
void setType (option opt, bool adjust=false)
 
bool compile () noexcept
 
void uncompile () noexcept
 
void uncompile (bool adjust)
 
void clear ()
 
void swap (keyType &rhs)
 
bool match (const std::string &text, bool literal=false) const
 
bool operator() (const std::string &text) const
 
void operator= (const std::string &)=delete
 
void operator= (const keyType &str)
 
void operator= (keyType &&str)
 
void operator= (const word &str)
 
void operator= (const string &str)
 
void operator= (const char *str)
 
 keyType (const std::string &s, bool isPattern)
 
- Public Member Functions inherited from word
 word ()=default
 
 word (const word &)=default
 
 word (word &&w)=default
 
 word (const string &s, bool doStrip=true)
 
 word (string &&s, bool doStrip=true)
 
 word (const std::string &s, bool doStrip=true)
 
 word (std::string &&s, bool doStrip=true)
 
 word (const char *s, bool doStrip=true)
 
 word (const char *s, size_type len, bool doStrip)
 
 word (Istream &is)
 
void stripInvalid ()
 
word lessExt () const
 
word ext () const
 
wordext (const word &ending)
 
wordoperator= (const word &s)
 
wordoperator= (word &&s)
 
wordoperator= (const string &s)
 
wordoperator= (string &&s)
 
wordoperator= (const std::string &s)
 
wordoperator= (std::string &&s)
 
wordoperator= (const char *s)
 
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
 
bool hasExt (const char *ending) const
 
bool hasExt (const std::string &ending) const
 
bool hasExt (const wordRe &ending) const
 
bool removeExt ()
 
- Public Member Functions inherited from string
 string ()=default
 
 string (const std::string &str)
 
 string (std::string &&str)
 
 string (const char *str)
 
 string (const char *str, const size_type len)
 
 string (const char c)
 
 string (const size_type len, const char c)
 
 string (Istream &is)
 
bool match (const std::string &text) const
 
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)
 
bool removeStart (const std::string &text)
 
bool removeStart (const char c)
 
bool removeEnd (const std::string &text)
 
bool removeEnd (const char c)
 
void swap (std::string &str)
 
bool operator() (const std::string &text) const
 
bool starts_with (const std::string &s) const
 
bool starts_with (const char c) const
 
bool ends_with (const std::string &s) const
 
bool ends_with (const char c) const
 
size_type count (const char c) const
 
bool startsWith (const std::string &s) const
 
bool endsWith (const std::string &s) const
 
bool removeTrailing (const char c)
 

Static Public Member Functions

static bool valid (const char c)
 
- Static Public Member Functions inherited from word
template<class PrimitiveType >
static word printf (const char *fmt, const PrimitiveType &val)
 
template<class PrimitiveType >
static word printf (const std::string &fmt, const PrimitiveType &val)
 
static bool valid (char c)
 
static word validate (const std::string &s, const bool prefix=false)
 
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)
 
template<class StringType >
static bool stripInvalid (std::string &str)
 
template<class StringType >
static StringType validate (const std::string &str)
 

Static Public Attributes

static const keyType null
 
- Static Public Attributes inherited from word
static const char *const typeName = "word"
 
static int debug
 
static const word null
 
- Static Public Attributes inherited from string
static const char *const typeName = "string"
 
static int debug
 
static const string null
 

Additional Inherited Members

- Protected Member Functions inherited from string
std::string::size_type find_ext () const
 
word ext () const
 
bool ext (const word &ending)
 
bool hasPath () const
 
bool hasExt () const
 
bool hasExt (const char *ending) const
 
bool hasExt (const std::string &ending) const
 
bool hasExt (const wordRe &ending) const
 
bool removeExt ()
 
bool removePath ()
 
- Static Protected Member Functions inherited from string
static std::string::size_type find_ext (const std::string &str)
 
template<class PrimitiveType >
static std::string::size_type string_printf (std::string &output, const char *fmt, const PrimitiveType &val)
 
template<class PrimitiveType >
static std::string::size_type string_printf (std::string &output, const std::string &fmt, const PrimitiveType &val)
 

Detailed Description

A class for handling keywords in dictionaries.

A keyType is the keyword of a dictionary. It differs from word in that it also accepts patterns (regular expressions). It is very similar to wordRe, but doesn't store a regular expression.

Source files

Definition at line 66 of file keyType.H.

Member Enumeration Documentation

◆ option

enum option : unsigned char
Enumerator
LITERAL 

String literal.

REGEX 

Regular expression.

RECURSIVE 

Recursive search (eg, in dictionary)

LITERAL_RECURSIVE 
REGEX_RECURSIVE 

Definition at line 76 of file keyType.H.

Constructor & Destructor Documentation

◆ keyType() [1/12]

keyType ( )
inline

Definition at line 33 of file keyTypeI.H.

◆ keyType() [2/12]

keyType ( const keyType )
default

◆ keyType() [3/12]

keyType ( keyType &&  )
default

◆ keyType() [4/12]

keyType ( const word str)
inline

Definition at line 40 of file keyTypeI.H.

◆ keyType() [5/12]

keyType ( word &&  str)
inline

Definition at line 47 of file keyTypeI.H.

◆ keyType() [6/12]

keyType ( const string str)
inline

Definition at line 54 of file keyTypeI.H.

◆ keyType() [7/12]

keyType ( string &&  str)
inline

Definition at line 61 of file keyTypeI.H.

◆ keyType() [8/12]

keyType ( const std::string &  str,
option  opt 
)
inline

Definition at line 68 of file keyTypeI.H.

◆ keyType() [9/12]

keyType ( std::string &&  str,
option  opt 
)
inline

Definition at line 75 of file keyTypeI.H.

◆ keyType() [10/12]

keyType ( const char *  str,
option  opt = option::LITERAL 
)
inline

Definition at line 82 of file keyTypeI.H.

◆ keyType() [11/12]

keyType ( Istream is)
explicit

Definition at line 35 of file keyType.C.

◆ keyType() [12/12]

keyType ( const std::string &  s,
bool  isPattern 
)
inline

Definition at line 234 of file keyType.H.

Member Function Documentation

◆ valid()

bool valid ( const char  c)
inlinestatic

Definition at line 24 of file keyTypeI.H.

References Foam::constant::universal::c, and word::valid().

Here is the call graph for this function:

◆ isLiteral()

bool isLiteral ( ) const
inlinenoexcept

Definition at line 91 of file keyTypeI.H.

Referenced by GeometricField::Boundary::readField().

Here is the caller graph for this function:

◆ isPattern()

bool isPattern ( ) const
inlinenoexcept

◆ assign()

bool assign ( const token tok)

Definition at line 66 of file keyType.C.

References Foam::FieldOps::assign(), token::isQuotedString(), token::isWord(), token::stringToken(), and token::wordToken().

Referenced by Foam::operator>>().

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

◆ setType()

void setType ( option  opt,
bool  adjust = false 
)
inline

Definition at line 103 of file keyTypeI.H.

References word::debug.

◆ compile()

bool compile ( )
inlinenoexcept

Definition at line 120 of file keyTypeI.H.

◆ uncompile() [1/2]

void uncompile ( )
inlinenoexcept

Definition at line 127 of file keyTypeI.H.

◆ uncompile() [2/2]

void uncompile ( bool  adjust)
inline

Definition at line 133 of file keyTypeI.H.

References word::debug.

◆ clear()

void clear ( )
inline

Definition at line 145 of file keyTypeI.H.

References clear().

Here is the call graph for this function:

◆ swap()

void swap ( keyType rhs)

Definition at line 43 of file keyType.C.

References string::swap().

Here is the call graph for this function:

◆ match()

bool match ( const std::string &  text,
bool  literal = false 
) const

Definition at line 55 of file keyType.C.

References regExpPosix::match().

Here is the call graph for this function:

◆ operator()()

bool operator() ( const std::string &  text) const
inline

Definition at line 154 of file keyTypeI.H.

References Foam::stringOps::match().

Here is the call graph for this function:

◆ operator=() [1/6]

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

◆ operator=() [2/6]

void operator= ( const keyType str)
inline

Definition at line 160 of file keyTypeI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [3/6]

void operator= ( keyType &&  str)
inline

Definition at line 172 of file keyTypeI.H.

References clear().

Here is the call graph for this function:

◆ operator=() [4/6]

void operator= ( const word str)
inline

Definition at line 191 of file keyTypeI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [5/6]

void operator= ( const string str)
inline

Definition at line 198 of file keyTypeI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

◆ operator=() [6/6]

void operator= ( const char *  str)
inline

Definition at line 184 of file keyTypeI.H.

References Foam::FieldOps::assign().

Here is the call graph for this function:

Member Data Documentation

◆ null

const Foam::keyType null
static

Definition at line 103 of file keyType.H.


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