16 #include <initializer_list> 25 std::string initialization_values,
26 bool allow_out_of_range)
29 *
this = initialization_values;
33 const char * initialization_values,
34 bool allow_out_of_range)
35 :
MultiMooseEnum(valid_names,
std::string(initialization_values), allow_out_of_range)
46 :
MooseEnumBase(other_enum), _current_values(other_enum._current_values)
72 return !(*
this ==
value);
105 for (
const auto & item :
value._current_values)
123 std::vector<std::string> names_vector;
125 return assignValues(names_vector.begin(), names_vector.end(),
false);
143 std::vector<std::string> names_vector;
151 mooseDeprecated(
"MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
164 mooseDeprecated(
"MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
177 mooseDeprecated(
"MultiMooseEnum::erase is deprecated, use MultiMooseEnum::eraseSetValue");
184 std::vector<std::string> names_vector;
186 assignValues(names_vector.begin(), names_vector.end(),
true);
193 "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
207 "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
221 "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
235 "MultiMooseEnum::push_back is deprecated, use MultiMooseEnum::setAdditionalValue");
243 "Access out of bounds in MultiMooseEnum (i: " << i <<
" size: " 253 "Access out of bounds in MultiMooseEnum (i: " << i <<
" size: " 259 template <
typename InputIterator>
266 for (InputIterator it = first; it != last; ++it)
268 const auto iter =
find(*it);
274 "\" in MultiMooseEnum. Valid options (not case-sensitive) are \"",
291 template <
typename InputIterator>
296 for (InputIterator it = first; it != last; ++it)
298 std::vector<MooseEnumItem>::iterator iter =
316 mooseDeprecated(
"MultiMooseEnum::clear is deprecated, use MultiMooseEnum::clearSetValues");
350 mooseDeprecated(
"MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName");
357 for (
const auto &
name : names)
364 mooseDeprecated(
"MultiMooseEnum::operator+= is deprecated, use MultiMooseEnum::addValidName");
371 for (
const auto & item : names.
_items)
std::ostream & operator<<(std::ostream &out, const MultiMooseEnum &obj)
const std::string & operator[](unsigned int i) const
Indexing operator Operator to retrieve an item from the MultiMooseEnum.
std::string name(const ElemQuality q)
int getNextValidID() const
Compute the next valid ID.
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.
bool operator!=(const MultiMooseEnum &value) const
void tokenize(const std::string &str, std::vector< T > &elements, unsigned int min_len=1, const std::string &delims="/")
This function will split the passed in string on a set of delimiters appending the substrings to the ...
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
MultiMooseEnum()
Protected constructor for use by libmesh::Parameters.
void addValidName(const std::string &name)
Extends the range of possible values the variable can be set to.
void removeSetValues(InputIterator first, InputIterator last)
Helper method for un-assigning enumeration values.
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
MooseEnumIterator end() const
std::string getRawNames() const
Method for returning the raw name strings for this instance.
The base class for both the MooseEnum and MultiMooseEnum classes.
MooseEnumBase & operator+=(const std::string &name)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const MooseEnumItem & addEnumerationName(const std::string &raw_name)
virtual void checkDeprecated() const =0
Method that must be implemented to check derived class values against the _deprecated_names.
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
void erase(const std::string &names)
Un-assign, or unset a value.
std::string stringify(const T &t)
conversion to string
std::set< MooseEnumItem > _items
Storage for the assigned items.
MultiMooseEnum & operator=(const MultiMooseEnum &other_enum)=default
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used...
unsigned int get(unsigned int i) const
Indexing operator Operator to retrieve the id of an item from the MultiMooseEnum. ...
Class for containing MooseEnum item information.
bool operator==(const MultiMooseEnum &value) const
Comparison operators for comparing with character constants, MultiMooseEnums or integer values...
void push_back(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
void clearSetValues()
Clear the MultiMooseEnum.
void eraseSetValue(const std::string &names)
Un-assign, or unset a value.
bool _allow_out_of_range
Flag to enable enumeration items not previously defined.
MooseEnumBase & operator+=(const std::string &name)
Adds an enumeration item from name.