diff options
author | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-25 01:00:41 +0000 |
---|---|---|
committer | cduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-25 01:00:41 +0000 |
commit | 0ba7b4f2a2295978d3747573ef0332f7e410889b (patch) | |
tree | 93769dd77f84c9463e1a8ad8a6dff5be850f895e /tools/json_schema_compiler/util.h | |
parent | dd5d7cc6a98df018e0018cd23b72a1b6287be0c4 (diff) | |
download | chromium_src-0ba7b4f2a2295978d3747573ef0332f7e410889b.zip chromium_src-0ba7b4f2a2295978d3747573ef0332f7e410889b.tar.gz chromium_src-0ba7b4f2a2295978d3747573ef0332f7e410889b.tar.bz2 |
Extensions Docs Server: Enum values do not show up if enum is a type
If an enumerated string is a type, the possible values were not shown.
BUG=146301
Review URL: https://chromiumcodereview.appspot.com/10907151
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/util.h')
-rw-r--r-- | tools/json_schema_compiler/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/json_schema_compiler/util.h b/tools/json_schema_compiler/util.h index 509b0dc..6943590 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> |