示例#1
0
MultiMooseEnum &
MultiMooseEnum::assign(InputIterator first, InputIterator last, bool append)
{
  if (!append)
    clear();

  std::copy(first, last, std::back_inserter(_current_names_preserved));
  for (InputIterator it = first; it != last; ++it)
  {
    std::string upper(*it);
    std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper);

    checkDeprecatedBase(upper);

    _current_names.insert(upper);

    if (std::find(_names.begin(), _names.end(), upper) == _names.end())
    {
      if (_out_of_range_index == 0)     // Are out of range values allowed?
        mooseError("Invalid option \"" << upper << "\" in MultiMooseEnum.  Valid options (not case-sensitive) are \"" << _raw_names << "\".");
      else
      {
        // Allow values assigned outside of the enumeration range
        _names.push_back(upper);

        int current_id = _out_of_range_index++;
        _name_to_id[upper] = current_id;

        _current_ids.push_back(current_id);
      }
    }
    else
      _current_ids.push_back(_name_to_id[upper]);
  }
  return *this;
}
示例#2
0
void
MultiMooseEnum::checkDeprecated() const
{
  for (const auto & name : _current_names)
    checkDeprecatedBase(name);
}
示例#3
0
void
MultiMooseEnum::checkDeprecated() const
{
  for (std::set<std::string>::const_iterator it = _current_names.begin(); it != _current_names.end(); ++it)
    checkDeprecatedBase(*it);
}