Index: tools/json_schema_compiler/cpp_util.py |
diff --git a/tools/json_schema_compiler/cpp_util.py b/tools/json_schema_compiler/cpp_util.py |
index 2de42293fba9c4b444978f64292ced4153f986e5..2d4934393443e25ebcfb29986c9b2d49a265e18a 100644 |
--- a/tools/json_schema_compiler/cpp_util.py |
+++ b/tools/json_schema_compiler/cpp_util.py |
@@ -7,7 +7,7 @@ |
from code import Code |
from datetime import datetime |
-from model import Property, PropertyType, Type |
+from model import PropertyType |
import os |
import re |
@@ -34,6 +34,7 @@ def Classname(s): |
""" |
return '_'.join([x[0].upper() + x[1:] for x in re.split('\W', s)]) |
+ |
def GetAsFundamentalValue(type_, src, dst): |
"""Returns the C++ code for retrieving a fundamental type from a |
Value into a variable. |
@@ -48,6 +49,7 @@ def GetAsFundamentalValue(type_, src, dst): |
PropertyType.STRING: '%s->GetAsString(%s)', |
}[type_.property_type] % (src, dst) |
+ |
def GetValueType(type_): |
"""Returns the Value::Type corresponding to the model.Type. |
""" |
@@ -64,6 +66,7 @@ def GetValueType(type_): |
PropertyType.STRING: 'base::Value::TYPE_STRING', |
}[type_.property_type] |
+ |
def GetParameterDeclaration(param, type_): |
"""Gets a parameter declaration of a given model.Property and its C++ |
type. |
@@ -82,6 +85,7 @@ def GetParameterDeclaration(param, type_): |
'name': param.unix_name, |
} |
+ |
def GenerateIfndefName(path, filename): |
"""Formats a path and filename as a #define name. |
@@ -90,12 +94,14 @@ def GenerateIfndefName(path, filename): |
return (('%s_%s_H__' % (path, filename)) |
.upper().replace(os.sep, '_').replace('/', '_')) |
+ |
def PadForGenerics(var): |
"""Appends a space to |var| if it ends with a >, so that it can be compiled |
within generic types. |
""" |
return ('%s ' % var) if var.endswith('>') else var |
+ |
def OpenNamespace(namespace): |
"""Get opening root namespace declarations. |
""" |
@@ -104,6 +110,7 @@ def OpenNamespace(namespace): |
c.Append('namespace %s {' % component) |
return c |
+ |
def CloseNamespace(namespace): |
"""Get closing root namespace declarations. |
""" |