What\'s the cleanest way to store an enum in XML and read it back out again? Say I\'ve got:
enum ETObjectType {ETNormalObjectType, ETRareObjectType, ETEssent
I'm experimenting with this solution -
static NSString *stepTypeEnum[kStepTypeCount] = {@"one",@"two",@"three",@"four"};
int enumFromStrings(NSString*findString,NSString *strings[],int enumMax){
for (int i=0;i
I like it because it checks the length of the string array at compile time, and the enumFromStrings function is generic and reusable. You call it like so:
-(void)setType:(NSString*)typeString{
type = enumFromStrings(typeString,stepTypeEnum,kStepTypeCount);
}