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)
61 if (value.size() !=
size())
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: "
259template <
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 \"",
291template <
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)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
std::ostream & operator<<(std::ostream &out, const MultiMooseEnum &obj)
The base class for both the MooseEnum and MultiMooseEnum classes.
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.
std::set< MooseEnumItem > _items
Storage for the assigned items.
int getNextValidID() const
Compute the next valid ID.
const MooseEnumItem & addEnumerationName(const std::string &raw_name)
std::set< MooseEnumItem >::const_iterator find(const MooseEnumItem &other) const
Locate an item.
const MooseEnumItem & addEnumerationItem(const MooseEnumItem &item)
virtual void checkDeprecated() const =0
Method that must be implemented to check derived class values against the _deprecated_names.
std::string getRawNames() const
Method for returning the raw name strings for this instance.
Class for containing MooseEnum item information.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
MultiMooseEnum()
Protected constructor for use by libmesh::Parameters.
const std::string & operator[](unsigned int i) const
Indexing operator Operator to retrieve an item from the MultiMooseEnum.
bool operator!=(const MultiMooseEnum &value) const
MooseEnumBase & operator+=(const std::string &name)
std::vector< MooseEnumItem > _current_values
The current value(s) of the MultiMooseEnum.
void eraseSetValue(const std::string &names)
Un-assign, or unset a value.
void erase(const std::string &names)
Un-assign, or unset a value.
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
virtual void checkDeprecated() const override
Check whether any of the current values are deprecated when called.
bool operator==(const MultiMooseEnum &value) const
Comparison operators for comparing with character constants, MultiMooseEnums or integer values.
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
unsigned int get(unsigned int i) const
Indexing operator Operator to retrieve the id of an item from the MultiMooseEnum.
MooseEnumIterator end() const
void addValidName(const std::string &name)
Extends the range of possible values the variable can be set to.
MultiMooseEnum & assignValues(InputIterator first, InputIterator last, bool append)
Helper method for all inserts and assignment operators.
void push_back(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
unsigned int size() const
Return the number of active items in the MultiMooseEnum.
void clearSetValues()
Clear the MultiMooseEnum.
MooseEnumIterator begin() const
Returns a begin/end iterator to all of the set values in the enum.
MultiMooseEnum & operator=(const MultiMooseEnum &other_enum)=default
Copy Assignment operator must be explicitly defined when a copy ctor exists and this method is used.
void removeSetValues(InputIterator first, InputIterator last)
Helper method for un-assigning enumeration values.
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 ...
std::string stringify(const T &t)
conversion to string