ROEnumMetaData

Overview

This is the base class for building enumeration value to string converters. Concrete descendants of this class are generated by codegen for every enum defined in the corresponding RODL. Natively Objective C enums are nothing more but integer constants and there is no native method to convert an integer value of the enum to a string looking similar to how it is defined in the source code (and vice versa) at run time. Such conversion is necessary for text based messaging protocols such as SOAP and JSON.

Location

Properties


typeName

Returns the enum name as it is defined in the RODL.

@property (readonly) NSString *typeName

Instance Methods


stringFromValue:

Converts an integer enum value to the corresponding string representation. Values that does not fall into the corresponding enum values range are converted into a error string like "Invalid value for enum ".

- (NSString *) stringFromValue:(int32)value

Parameters:

  • value: An integer enum value

valueFromString:

Converts a string enum value to the corresponding integer. This method returns -1 for incorrect enum strings.

- (int32) valueFromString:(NSString *)string

Parameters:

  • string: String representation of the enum value

Descendants