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 2d4934393443e25ebcfb29986c9b2d49a265e18a..c8f4bbe21de52ad8456c9dc4d9ac74a00f38f0f2 100644 |
--- a/tools/json_schema_compiler/cpp_util.py |
+++ b/tools/json_schema_compiler/cpp_util.py |
@@ -24,6 +24,10 @@ GENERATED_BUNDLE_FILE_MESSAGE = """// GENERATED FROM THE API DEFINITIONS IN |
// %s |
// DO NOT EDIT. |
""" |
+GENERATED_FEATURE_MESSAGE = """// GENERATED FROM THE FEATURE DEFINITIONS IN |
+// %s |
+// DO NOT EDIT. |
+""" |
def Classname(s): |
"""Translates a namespace name or function name into something more |
@@ -118,3 +122,16 @@ def CloseNamespace(namespace): |
for component in reversed(namespace.split('::')): |
c.Append('} // namespace %s' % component) |
return c |
+ |
+def RemoveFeatureDuplicates(feature_list): |
+ """Return a list of features where any feature with the same name is tossed. |
+ """ |
+ feature_set = set() |
+ return [feature for feature in feature_list if feature.name not in |
+ feature_set and not feature_set.add(feature.name)] |
not at google - send to devlin
2013/09/13 21:37:52
this isn't c++ related, it's model related. howeve
dhnishi (use Chromium)
2013/09/16 22:26:21
Done.
|
+ |
+def ConstantName(feature_name): |
+ """Returns a kName for a feature's name. |
+ """ |
+ return ('k' + ''.join(word[0].upper() + word[1:] |
+ for word in feature_name.replace('.', ' ').split())) |