Objective-C Reflection

For glDebug I generate a lot of code so save having to write and update it, both for the call intercept library, and the application. More recently in the application, I’ve added an event list similar to the one in PIX where it shows the parameters.
Screen Shot 2014-04-28 at 04.37.46

So to generate this, I generate an overload of my base command class for every method, and changing the description function to return based on the parameter type and function name.

Then to create the class, I just get the class by the function name prefixed with “GLDebug_”.

Class createClass = NSClassFromString([NSString stringWithFormat:@"GLDebug_%@", commandName]);
 
//
if(createClass == nil)
{
	createClass = [CommandData class];
}
 
//				
CommandData * commandData = [[createClass alloc] initWithPacket:packet];

Now in my outline view I can just use the description string. One limitation however is I want to replace GLenum with the correct enum string. However it appears there are some enums sharing the same name. I may need to generate a spreadsheet and fill out the enums manually.