Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values. All dictionary searches use a literal (not regex). More...
Classes | |
| class | const_iterator |
| A const_iterator for iterating an Enum list. More... | |
Public Types | |
| typedef word | key_type |
| The type of keys used. More... | |
| typedef EnumType | value_type |
| The type of enumeration represented by the Enum. More... | |
Public Member Functions | |
| Enum () noexcept=default | |
| Default construct, an empty list. More... | |
| Enum (std::initializer_list< std::pair< EnumType, const char *>> list) | |
| Construct from a values/names list. More... | |
| bool | empty () const noexcept |
| True if the enumeration list is empty. More... | |
| label | size () const noexcept |
| The number of name/value pairs for the enumeration. More... | |
| const List< word > & | names () const noexcept |
| The list of enum names, in construction order. Same as toc() More... | |
| const List< int > & | values () const noexcept |
| The list of enum values, in construction order. More... | |
| const List< word > & | toc () const noexcept |
| The list of enum names, in construction order. Same as names() More... | |
| List< word > | sortedToc () const |
| The sorted list of enum names. More... | |
| void | clear () |
| Clear all entries. More... | |
| void | push_back (std::initializer_list< std::pair< EnumType, const char *>> list) |
| Append value/key pairs to the lists of known enumerations. More... | |
| label | find (const word &enumName) const |
| Find the index of the given name. More... | |
| label | find (const EnumType e) const |
| Find the first index of given enumeration. More... | |
| bool | found (const word &enumName) const |
| True if there is an enumeration corresponding to the given name. More... | |
| bool | found (const EnumType e) const |
| True if there is a name corresponding to the given enumeration. More... | |
| EnumType | get (const word &enumName) const |
| The enumeration corresponding to the given name. More... | |
| const word & | get (const EnumType e) const |
| The name corresponding to the given enumeration. More... | |
| EnumType | lookup (const word &enumName, const EnumType deflt) const |
| The enumeration corresponding to the given name. More... | |
| EnumType | get (const word &key, const dictionary &dict) const |
| Get the key in the dictionary and return the corresponding enumeration element based on its name. More... | |
| EnumType | getOrDefault (const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const |
| Find the key in the dictionary and return the corresponding enumeration element based on its name. More... | |
| bool | readEntry (const word &key, const dictionary &dict, EnumType &val, const bool mandatory=true) const |
| Find entry and assign to T val. More... | |
| bool | readIfPresent (const word &key, const dictionary &dict, EnumType &val) const |
| Find an entry if present, and assign to T val. More... | |
| EnumType | read (Istream &is) const |
| Read a word from Istream and return the corresponding enumeration. More... | |
| bool | read (Istream &is, EnumType &val, const bool mandatory=true) const |
| Read a word from Istream, lookup named enumeration. More... | |
| void | write (const EnumType e, Ostream &os) const |
| Write the name representation of the enumeration to an Ostream. More... | |
| template<class OS > | |
| OS & | writeList (OS &os, const label ununsed=0) const |
| Write enumeration names as a list without line-breaks to an output stream. More... | |
| EnumType | operator[] (const word &enumName) const |
| Return the enumeration corresponding to the given name. More... | |
| const word & | operator[] (const EnumType e) const |
| Return the first name corresponding to the given enumeration, or an empty word on failure. More... | |
| const_iterator | cbegin () const noexcept |
| const_iterator | cend () const noexcept |
| const_iterator | begin () const noexcept |
| const_iterator | end () const noexcept |
| EnumType | lookupOrDefault (const word &key, const dictionary &dict, const EnumType deflt, const bool failsafe=false) const |
| Find the key in the dictionary and return the corresponding enumeration element based on its name. More... | |
| const word & | operator() (const EnumType e) const |
| Deprecated(2020-11) use get() method. More... | |
| EnumType | operator() (const word &key, const EnumType deflt) const |
| Deprecated(2020-11) use two-parameter lookup() method. More... | |
| EnumType | get (const word &key, const EnumType deflt) const |
| Deprecated(2020-11) use two-parameter lookup() method. More... | |
| EnumType | lookup (const word &key, const dictionary &dict) const |
| Deprecated(2018-10) same as two-parameter get() method. More... | |
| void | append (std::initializer_list< std::pair< EnumType, const char *>> list) |
| Append value/key pairs to the lists of known enumerations. More... | |
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values. All dictionary searches use a literal (not regex).
Definition at line 55 of file IOstreamOption.H.
| typedef EnumType value_type |
|
defaultnoexcept |
Default construct, an empty list.
|
explicit |
|
inlinenoexcept |
|
inlinenoexcept |
The number of name/value pairs for the enumeration.
Definition at line 31 of file EnumI.H.
Referenced by Enum< actionType >::cend().

|
inlinenoexcept |
The list of enum names, in construction order. Same as toc()
Definition at line 39 of file EnumI.H.
Referenced by Enum< EnumType >::const_iterator::key().

|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
The sorted list of enum names.
Definition at line 63 of file EnumI.H.
Referenced by filmTurbulenceModel::Cw().

| void push_back | ( | std::initializer_list< std::pair< EnumType, const char *>> | list | ) |
Append value/key pairs to the lists of known enumerations.
Does not check for duplicate entries
Definition at line 49 of file Enum.C.
Referenced by Enum< actionType >::append().

|
inline |
|
inline |
|
inline |
True if there is an enumeration corresponding to the given name.
Definition at line 96 of file EnumI.H.
Referenced by FIREMeshReader::readGeometry().

|
inline |
| EnumType get | ( | const word & | enumName | ) | const |
The enumeration corresponding to the given name.
FatalError if not found.
Definition at line 68 of file Enum.C.
Referenced by filmTurbulenceModel::filmTurbulenceModel(), limitFields::read(), externalHeatFluxSource::read(), lumpedPointMovement::readDict(), and cellBitSet::select().

|
inline |
The enumeration corresponding to the given name.
Definition at line 85 of file Enum.C.
Referenced by Enum< actionType >::get(), Foam::getStopAction(), Enum< actionType >::operator()(), and derivedFields::read().

| EnumType get | ( | const word & | key, |
| const dictionary & | dict | ||
| ) | const |
| EnumType getOrDefault | ( | const word & | key, |
| const dictionary & | dict, | ||
| const EnumType | deflt, | ||
| const bool | failsafe = false |
||
| ) | const |
Find the key in the dictionary and return the corresponding enumeration element based on its name.
| key | Lookup key. Uses LITERAL (not REGEX) |
| dict | dictionary |
| deflt | fallback if not found |
| failsafe | Warn only on bad enumeration |
Definition at line 172 of file Enum.C.
Referenced by distributedTriSurfaceMesh::distributedTriSurfaceMesh(), Enum< actionType >::lookupOrDefault(), abort::read(), and writeObjects::read().

| bool readEntry | ( | const word & | key, |
| const dictionary & | dict, | ||
| EnumType & | val, | ||
| const bool | mandatory = true |
||
| ) | const |
Find entry and assign to T val.
FatalIOError if the enumeration is incorrect, or when it is mandatory but was not found.
| key | Lookup key. Uses LITERAL (not REGEX) |
| dict | dictionary |
| val | the value to read into |
| mandatory | the keyword is mandatory |
|
inline |
Find an entry if present, and assign to T val.
FatalIOError if the enumeration is incorrect. Default search: non-recursive with patterns.
| key | Lookup key. Uses LITERAL (not REGEX) |
| dict | dictionary |
| val | the value to read into |
Definition at line 125 of file EnumI.H.
Referenced by surfaceNoise::read(), LduMatrix< Type, DType, LUType >::solver::readControls(), lduMatrix::solver::readControls(), Time::readDict(), and surfaceWriter::surfaceWriter().

| EnumType read | ( | Istream & | is | ) | const |
Read a word from Istream and return the corresponding enumeration.
Definition at line 102 of file Enum.C.
Referenced by Foam::operator>>(), and addcommsTypeToOpt::readData().

| bool read | ( | Istream & | is, |
| EnumType & | val, | ||
| const bool | mandatory = true |
||
| ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Definition at line 226 of file EnumI.H.
Referenced by Enum< actionType >::begin().

|
inlinenoexcept |
Definition at line 234 of file EnumI.H.
Referenced by Enum< actionType >::end().

|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Find the key in the dictionary and return the corresponding enumeration element based on its name.
| key | Lookup key. Uses LITERAL (not REGEX) |
| dict | dictionary |
| deflt | fallback if not found |
| failsafe | Warn only on bad enumeration |
|
inline |
Deprecated(2020-11) use get() method.
|
inline |
Deprecated(2020-11) use two-parameter lookup() method.
|
inline |
Deprecated(2020-11) use two-parameter lookup() method.
|
inline |
Deprecated(2018-10) same as two-parameter get() method.
|
inline |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.