54template<
class EnumType>
class Enum;
60template<
class EnumType>
75 std::is_enum_v<EnumType> || std::is_integral_v<EnumType>,
76 "Enum must be enum or an integral type"
100 std::initializer_list<std::pair<EnumType, const
char*>> list
136 std::initializer_list<std::pair<EnumType, const
char*>> list
146 inline
bool contains(const EnumType
e) const;
150 EnumType
get(const
word& enumName) const;
154 inline const
word&
get(const EnumType
e) const;
159 EnumType
lookup(const
word& enumName, const EnumType deflt) const;
183 const EnumType deflt,
184 const
bool warnOnly = false
198 const
bool mandatory = true,
199 const
bool warnOnly = false
212 const
bool warnOnly = false
227 const
bool mandatory = true
237 inline OS&
writeList(OS&
os, const label ununsed=0) const;
245 EnumType operator[](const
word&
k)
const {
return get(
k); }
267 const Enum* eptr =
nullptr,
275 inline const word&
key() const;
278 inline EnumType
val() const;
281 explicit operator
bool() const
noexcept {
return good(); }
320 const EnumType deflt,
321 const
bool warnOnly = false
330 const
word& operator()(const EnumType
e)
const
338 EnumType operator()(const
word&
key, const EnumType deflt)
const
346 EnumType
get(const
word&
key, const EnumType deflt)
const
364 std::initializer_list<std::pair<EnumType, const
char*>> list
383template<
class EnumType>
387template<
class EnumType>
A const_iterator for iterating an Enum list.
const_iterator & operator++() noexcept
Move to the next index.
EnumType val() const
Enumeration value at the current index.
bool good() const noexcept
True if iterator points to an entry.
const word & key() const
The name at the current index.
const word & operator*() const
De-referencing returns the name (key).
const_iterator(const Enum *eptr=nullptr, const label idx=0) noexcept
Default construct, construct at given position.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const_iterator cbegin() const noexcept
EnumType lookupOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Same as getOrDefault().
const_iterator begin() const noexcept
const List< int > & values() const noexcept
The list of enum values, in construction order.
EnumType operator[](const word &k) const
Return the enumeration corresponding to the given name.
bool empty() const noexcept
True if the enumeration list is empty.
bool readEntry(const word &key, const dictionary &dict, EnumType &val, const bool mandatory=true, const bool warnOnly=false) const
Find entry and assign to T val.
void push_back(std::initializer_list< std::pair< EnumType, const char * > > list)
Append value/key pairs to the lists of known enumerations.
OS & writeList(OS &os, const label ununsed=0) const
Write enumeration names as a list without line-breaks to an output stream.
const_iterator end() const noexcept
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
Enum() noexcept=default
Default construct, an empty list.
EnumType value_type
The type of enumeration represented by the Enum.
const_iterator cend() const noexcept
void write(const EnumType e, Ostream &os) const
Write the name representation of the enumeration to an Ostream.
const List< word > & names() const noexcept
The list of enum names, in construction order. Same as toc().
label size() const noexcept
The number of name/value pairs for the enumeration.
const_iterator find(const EnumType e) const
const_iterator cfind(const word &key) const
Find key/value pair by enumeration name.
const List< word > & toc() const noexcept
The list of enum names, in construction order. Same as names().
bool found(const EnumType e) const
Same as contains().
List< word > sortedToc() const
The sorted list of enum names.
EnumType read(Istream &is) const
Read a word from Istream and return the corresponding enumeration.
const_iterator find(const word &key) const
void clear()
Clear all entries.
const word & operator[](EnumType e) const
Return the first name corresponding to the given enumeration, or an empty word if not found.
word key_type
The type of keys used.
bool found(const word &key) const
Same as contains().
EnumType getOrDefault(const word &key, const dictionary &dict, const EnumType deflt, const bool warnOnly=false) const
Find the key in the dictionary and return the corresponding enumeration element based on its name.
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
EnumType get(const word &enumName) const
The enumeration corresponding to the given name.
bool contains(const word &enumName) const
True if there is an enumeration corresponding to the given name.
void append(std::initializer_list< std::pair< EnumType, const char * > > list)
Append value/key pairs to the lists of known enumerations.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
#define FOAM_DEPRECATED_FOR(since, replacement)
#define FOAM_DEPRECATED_STRICT(since, replacement)