23 std::vector<std::string> parsed;
24 parsed.reserve( enumValues.size() );
25 for(
auto const& enumValue : enumValues ) {
27 parsed.push_back(
Catch::trim( identifiers.back() ) );
35 for(
auto const& valueToName :
m_values ) {
36 if( valueToName.first ==
value )
37 return valueToName.second;
39 return "{** unexpected enum value **}";
43 std::unique_ptr<EnumInfo> enumInfo(
new EnumInfo );
44 enumInfo->m_name = enumName;
45 enumInfo->m_values.reserve( values.size() );
48 assert( valueNames.size() == values.size() );
50 for(
auto value : values )
51 enumInfo->m_values.push_back({
value, valueNames[i++] });
56 EnumInfo
const& EnumValuesRegistry::registerEnum(
StringRef enumName,
StringRef allValueNames, std::vector<int>
const& values ) {
57 auto enumInfo =
makeEnumInfo( enumName, allValueNames, values );
58 EnumInfo* raw = enumInfo.get();
59 m_enumInfos.push_back( std::move( enumInfo ) );
std::unique_ptr< EnumInfo > makeEnumInfo(StringRef enumName, StringRef allValueNames, std::vector< int > const &values)
std::vector< std::string > parseEnums(StringRef enums)
std::string trim(std::string const &str)
std::vector< StringRef > splitStringRef(StringRef str, char delimiter)
std::vector< std::pair< int, std::string > > m_values
StringRef lookup(int value) const
virtual ~IMutableEnumValuesRegistry()