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> |