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..34098200cab0f909cacd3353cb95d8546d56bf0a 100644 |
--- a/tools/json_schema_compiler/util.h |
+++ b/tools/json_schema_compiler/util.h |
@@ -44,6 +44,16 @@ bool GetItemFromList(const ListValue& from, int index, linked_ptr<T>* out) { |
return true; |
} |
+// This is used for getting an enum out of a ListValue. |
+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); |
not at google - send to devlin
2012/09/14 01:44:51
i don't understand, ListValue enums are stored as
cduvall
2012/09/17 22:07:46
I clarified the comment. This happens in the JSC t
|
+ 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> |