Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: tools/json_schema_compiler/cpp_util.py

Issue 12041098: Initial commit of the Dart Chrome Extension APIs generators (Closed) Base URL: http://git.chromium.org/chromium/src.git@file_path_bugfix
Patch Set: Kalman fixes 2 (nocompile ignored in bundle mode) Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/cpp_type_generator_test.py ('k') | tools/json_schema_compiler/cpp_util_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ce14ca9d835b61783b5ec1267b8165d69b139a0..9f908ea8db83bdcb384775ea325f5dcb9fed9ae3 100644
--- a/tools/json_schema_compiler/cpp_util.py
+++ b/tools/json_schema_compiler/cpp_util.py
@@ -5,6 +5,7 @@
"""Utilies and constants specific to Chromium C++ code.
"""
+from code import Code
from datetime import datetime
from model import Property, PropertyType, Type
import os
@@ -91,3 +92,19 @@ def PadForGenerics(var):
within generic types.
"""
return ('%s ' % var) if var.endswith('>') else var
+
+def OpenNamespace(namespace):
+ """Get opening root namespace declarations.
+ """
+ c = Code()
+ for component in namespace.split('::'):
+ c.Append('namespace %s {' % component)
+ return c
+
+def CloseNamespace(namespace):
+ """Get closing root namespace declarations.
+ """
+ c = Code()
+ for component in reversed(namespace.split('::')):
+ c.Append('} // namespace %s' % component)
+ return c
« no previous file with comments | « tools/json_schema_compiler/cpp_type_generator_test.py ('k') | tools/json_schema_compiler/cpp_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698