30template<
class EnumType>
37template<
class EnumType>
44template<
class EnumType>
52template<
class EnumType>
60template<
class EnumType>
68template<
class EnumType>
80template<
class EnumType>
88template<
class EnumType>
91 return (!key.empty() && keys_.contains(key));
95template<
class EnumType>
98 return vals_.contains(
int(
e));
102template<
class EnumType>
105 const label idx = vals_.find(
int(
e));
116template<
class EnumType>
130template<
class EnumType>
133 const label idx = vals_.find(
int(
e));
142template<
class EnumType>
149 for (
const word&
k : keys_)
162template<
class EnumType>
174template<
class EnumType>
178 return ptr_->names()[idx_];
182template<
class EnumType>
185 return EnumType(ptr_->values()[idx_]);
189template<
class EnumType>
192 return (ptr_ && idx_ >= 0 && idx_ < ptr_->
size());
196template<
class EnumType>
205template<
class EnumType>
211 return idx_ == iter.idx_;
215template<
class EnumType>
221 return idx_ != iter.idx_;
225template<
class EnumType>
233template<
class EnumType>
241template<
class EnumType>
245 const label idx = (key.empty() ? -1 : keys_.find(key));
250 (idx >= 0 ? idx : this->
size())
255template<
class EnumType>
259 const label idx = vals_.find(
int(
e));
264 (idx >= 0 ? idx : this->
size())
271template<
class EnumType>
278 return list.writeList(
os);
282template<
class EnumType>
283inline std::ostream& Foam::operator<<
289 return list.writeList(
os);
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_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
const List< int > & values() const noexcept
The list of enum values, in construction order.
bool empty() const noexcept
True if the enumeration list is empty.
bool readEntry(const word &key, const dictionary &dict, injectionMethod &val, const bool mandatory=true, const bool warnOnly=false) const
OS & writeList(OS &os, const label ununsed=0) const
Write enumeration names as a list without line-breaks to an output stream.
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.
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 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().
List< word > sortedToc() const
The sorted list of enum names.
void clear()
Clear all entries.
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
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.
static const word null
An empty word.
OBJstream os(runTime.globalPath()/outputName)
void sort(UList< T > &list)
Sort the list.