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

Side by Side Diff: tools/json_schema_compiler/util.cc

Issue 16462004: Add optional schema compiler error messages Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kalman's requests Created 7 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/json_schema_compiler/util.h" 5 #include "tools/json_schema_compiler/util.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 namespace json_schema_compiler { 9 namespace json_schema_compiler {
10 namespace util { 10 namespace util {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void AddItemToList(const linked_ptr<base::Value>& from, 63 void AddItemToList(const linked_ptr<base::Value>& from,
64 base::ListValue* out) { 64 base::ListValue* out) {
65 out->Append(from->DeepCopy()); 65 out->Append(from->DeepCopy());
66 } 66 }
67 67
68 void AddItemToList(const linked_ptr<base::DictionaryValue>& from, 68 void AddItemToList(const linked_ptr<base::DictionaryValue>& from,
69 base::ListValue* out) { 69 base::ListValue* out) {
70 out->Append(static_cast<Value*>(from->DeepCopy())); 70 out->Append(static_cast<Value*>(from->DeepCopy()));
71 } 71 }
72 72
73 std::string ValueTypeToString(Value::Type type) {
74 std::string out;
75 switch(type) {
76 case Value::TYPE_NULL:
77 out = "null";
78 break;
79 case Value::TYPE_BOOLEAN:
80 out = "boolean";
81 break;
82 case Value::TYPE_INTEGER:
83 out = "int";
84 break;
85 case Value::TYPE_DOUBLE:
86 out = "double";
87 break;
88 case Value::TYPE_STRING:
89 out = "std::string";
not at google - send to devlin 2013/06/14 21:48:39 just "string"
Aaron Jacobs 2013/06/15 00:47:18 Done.
90 break;
91 case Value::TYPE_BINARY:
92 out = "binary";
93 break;
94 case Value::TYPE_DICTIONARY:
95 out = "dictionary";
96 break;
97 case Value::TYPE_LIST:
98 out = "list";
99 break;
100 default:
101 NOTREACHED();
102 }
103
104 return out;
105 }
not at google - send to devlin 2013/06/14 21:48:39 1. this can be a lot shorter if you just have 'ret
Aaron Jacobs 2013/06/15 00:47:18 Done.
106
73 } // namespace api_util 107 } // namespace api_util
74 } // namespace extensions 108 } // namespace extensions
OLDNEW
« tools/json_schema_compiler/h_generator.py ('K') | « tools/json_schema_compiler/util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698