Implement DqnInspectEnum_Count function
This commit is contained in:
parent
3c447706c9
commit
41ac05b401
@ -45,6 +45,9 @@
|
||||
// =================================================================================================
|
||||
// See Data/DqnInspect_TestData.h
|
||||
|
||||
// TODO(doyle): Make the enum system similar to struct members for consistency?
|
||||
// TODO(doyle): Handle namespaces .. maybe.
|
||||
|
||||
#define DQN_INSPECT
|
||||
#define DQN_INSPECT_META(...)
|
||||
#define DQN_INSPECT_GENERATE_PROTOTYPE(...)
|
||||
@ -1744,7 +1747,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
//
|
||||
// Write InspectEnumString Function
|
||||
// NOTE: Write DqnInspectEnum_Stringify Function
|
||||
//
|
||||
{
|
||||
FprintfIndented(output_file, indent_level, "char const *DqnInspectEnum_Stringify(%.*s val, int *len = nullptr)\n{\n", parsed_enum->name.len, parsed_enum->name.str);
|
||||
@ -1809,6 +1812,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: Write DqnInspectEnum_Count Function
|
||||
//
|
||||
{
|
||||
int count = 0;
|
||||
for (CPPDeclLinkedList<Slice<char>> *link = parsed_enum->members; link; link = link->next) count++;
|
||||
FprintfIndented(output_file, indent_level, "int DqnInspectEnum_Count(%.*s) { return %d; }\n\n", parsed_enum->name.len, parsed_enum->name.str, count);
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: Write User Annotated Metadata Getter Functions
|
||||
//
|
||||
|
@ -287,6 +287,8 @@ char const *DqnInspectEnum_Stringify(EnumWithMetadata val, int *len = nullptr)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int DqnInspectEnum_Count(EnumWithMetadata) { return 3; }
|
||||
|
||||
char const * DqnInspectMetadata_FilePath(EnumWithMetadata val)
|
||||
{
|
||||
if (val == EnumWithMetadata::Rect) { return "Rect.vert"; }
|
||||
|
Loading…
Reference in New Issue
Block a user