diff --git a/tools/ocapigen/Code Generation/Generator/OCCodeGenerator.m b/tools/ocapigen/Code Generation/Generator/OCCodeGenerator.m index 08977fe8..e9e6b71c 100644 --- a/tools/ocapigen/Code Generation/Generator/OCCodeGenerator.m +++ b/tools/ocapigen/Code Generation/Generator/OCCodeGenerator.m @@ -96,6 +96,19 @@ - (OCCodeNativePropertyName)nativeNameForProperty:(OCSchemaProperty *)property i } } + if ([property.name hasPrefix:@"@"]) + { + NSRange dotRange; + + NSString *name = [property.name substringFromIndex:1]; + + while ((dotRange = [name rangeOfString:@"."]).location != NSNotFound) { + name = [[name substringToIndex:dotRange.location] stringByAppendingString:[name substringFromIndex:dotRange.location+1].withCapitalizedFirstChar]; + }; + + return (name); + } + return (property.name); } diff --git a/tools/ocapigen/YAML Parser/OCYAMLParser.m b/tools/ocapigen/YAML Parser/OCYAMLParser.m index 77b9d4f5..f169b4ee 100644 --- a/tools/ocapigen/YAML Parser/OCYAMLParser.m +++ b/tools/ocapigen/YAML Parser/OCYAMLParser.m @@ -131,6 +131,18 @@ - (void)parse NSString *name = [lineContent substringToIndex:splitPoint.location]; NSString *value = [[lineContent substringFromIndex:splitPoint.location+1] stringByTrimmingCharactersInSet:whitespaceCharSet]; + // Sanitize name + if ([name hasPrefix:@"'"] && [name hasSuffix:@"'"] && (name.length > 1)) + { + // Remove '' + name = [name substringWithRange:NSMakeRange(1, name.length-2)]; + } + if ([name hasPrefix:@"\""] && [name hasSuffix:@"\""] && (name.length > 1)) + { + // Remove '' + name = [name substringWithRange:NSMakeRange(1, name.length-2)]; + } + // Sanitize value if ([value isEqual:@""]) { value = nil; } @@ -139,6 +151,11 @@ - (void)parse // Remove '' value = [value substringWithRange:NSMakeRange(1, value.length-2)]; } + if ([value hasPrefix:@"\""] && [value hasSuffix:@"\""] && (value.length > 1)) + { + // Remove '' + value = [value substringWithRange:NSMakeRange(1, value.length-2)]; + } // Create node for line OCYAMLNode *node = [[OCYAMLNode alloc] initWithName:name value:value];