Skip to content

Commit

Permalink
Adding functions to show all available option of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
nadrino committed Nov 14, 2024
1 parent 6a719f2 commit 39019c6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/GenericToolbox.MakeEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ struct ENUM_NAME {
return StructType::overflowValue;
}

static std::vector<std::string> generateVectorStr(){
std::vector<std::string> out;
int nEntries{getEnumSize()};
out.reserve(nEntries);
for( int iEntry = 0 ; iEntry < nEntries ; iEntry++ ){
out.emplace_back( getEnumEntryToStr(iEntry) );
}
return out;
}
static std::string generateEnumStrList(){
std::stringstream ss;
int nEntries{getEnumSize()};
ss << "{ ";
for( int iEntry = 0 ; iEntry < nEntries ; iEntry++ ){
if( iEntry != 0 ){ ss << ", "; }
ss << "\"" << getEnumEntryToStr(iEntry) << "\"";
}
ss << " }";
return ss.str();
}

static std::string toString( EnumTypeName value_ ){
int nEntries{getEnumSize()};
for( int iEntry = 0 ; iEntry < nEntries ; iEntry++ ){
Expand Down

0 comments on commit 39019c6

Please sign in to comment.