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

Unified Diff: tools/dom/scripts/database.py

Issue 13704011: Map enums to strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/dom/scripts/dartgenerator.py ('k') | tools/dom/scripts/databasebuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/database.py
diff --git a/tools/dom/scripts/database.py b/tools/dom/scripts/database.py
index 387cc3fb18e1ea176293f2cefd23a6a0f8105da3..69e1963fca707728961c130e5fc1942361c6089c 100755
--- a/tools/dom/scripts/database.py
+++ b/tools/dom/scripts/database.py
@@ -42,6 +42,7 @@ class Database(object):
os.makedirs(root_dir)
self._all_interfaces = {}
self._interfaces_to_delete = []
+ self._enums = {}
self._idlparser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
def Clone(self):
@@ -49,6 +50,7 @@ class Database(object):
new_database._all_interfaces = copy.deepcopy(self._all_interfaces)
new_database._interfaces_to_delete = copy.deepcopy(
self._interfaces_to_delete)
+ new_database._enums = copy.deepcopy(self._enums)
return new_database
def Delete(self):
@@ -234,3 +236,12 @@ class Database(object):
continue
for parent_interface in self.Hierarchy(self.GetInterface(parent.type.id)):
yield parent_interface
+
+ def HasEnum(self, enum_name):
+ return enum_name in self._enums
+
+ def GetEnum(self, enum_name):
+ return self._enums[enum_name]
+
+ def AddEnum(self, enum):
+ self._enums[enum.id] = enum
« no previous file with comments | « tools/dom/scripts/dartgenerator.py ('k') | tools/dom/scripts/databasebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698