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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dbc117481ebe22a568af605fa3b59b66b11464fa |
--- /dev/null |
+++ b/tools/json_schema_compiler/cpp_util.py |
@@ -0,0 +1,26 @@ |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+"""Utilies and constants specific to Chromium C++ code. |
+""" |
+ |
+from datetime import datetime |
+ |
+CHROMIUM_LICENSE = ( |
+"""// Copyright (c) %d The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file.""" % datetime.now().year |
+) |
+GENERATED_FILE_MESSAGE = """// GENERATED FROM THE API DEFINITION IN |
+// %s |
+// DO NOT EDIT. |
+""" |
+ |
+def cpp_name(s): |
+ """Translates a namespace name or function name into something more |
+ suited to C++. |
+ |
+ eg experimental.downloads -> Experimental_Downloads |
+ updateAll -> UpdateAll. |
+ """ |
+ return '_'.join([x[0].upper() + x[1:] for x in s.split('.')]) |