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

Unified Diff: tools/json_schema_compiler/util.h

Issue 10907151: Extensions Docs Server: Enum values do not show up if enum is a type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/test/font_settings.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/util.h
diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h
index 509b0dc1a772a0a9aca503052d70f2446f7a3b8a..6943590050071c726893087ccb8f849af8ff6d44 100644
--- a/tools/json_schema_compiler/util.h
+++ b/tools/json_schema_compiler/util.h
@@ -44,6 +44,17 @@ bool GetItemFromList(const ListValue& from, int index, linked_ptr<T>* out) {
return true;
}
+// This is used for getting an enum out of a ListValue, which will happen if an
+// array of enums is a parameter to a function.
+template<class T>
+bool GetItemFromList(const ListValue& from, int index, T* out) {
+ int value;
+ if (!from.GetInteger(index, &value))
+ return false;
+ *out = static_cast<T>(value);
+ return true;
+}
+
// Populates |out| with |list|. Returns false if there is no list at the
// specified key or if the list has anything other than |T|.
template <class T>
« no previous file with comments | « tools/json_schema_compiler/test/font_settings.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698