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

Unified Diff: base/json/json_writer.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 | « base/json/json_value_serializer_unittest.cc ('k') | base/test/trace_event_analyzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_writer.cc
diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc
index 0b658eed59d6bec7ea881acc4f385ba9c33b6c06..07b9d5091c80f6ba3292bbfa711429c9ec44dc23 100644
--- a/base/json/json_writer.cc
+++ b/base/json/json_writer.cc
@@ -57,12 +57,12 @@ JSONWriter::JSONWriter(int options, std::string* json)
bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
switch (node.GetType()) {
- case Value::TYPE_NULL: {
+ case Value::Type::NONE: {
json_string_->append("null");
return true;
}
- case Value::TYPE_BOOLEAN: {
+ case Value::Type::BOOLEAN: {
bool value;
bool result = node.GetAsBoolean(&value);
DCHECK(result);
@@ -70,7 +70,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_INTEGER: {
+ case Value::Type::INTEGER: {
int value;
bool result = node.GetAsInteger(&value);
DCHECK(result);
@@ -78,7 +78,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_DOUBLE: {
+ case Value::Type::DOUBLE: {
double value;
bool result = node.GetAsDouble(&value);
DCHECK(result);
@@ -110,7 +110,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_STRING: {
+ case Value::Type::STRING: {
std::string value;
bool result = node.GetAsString(&value);
DCHECK(result);
@@ -118,7 +118,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_LIST: {
+ case Value::Type::LIST: {
json_string_->push_back('[');
if (pretty_print_)
json_string_->push_back(' ');
@@ -128,7 +128,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
bool result = node.GetAsList(&list);
DCHECK(result);
for (const auto& value : *list) {
- if (omit_binary_values_ && value->GetType() == Value::TYPE_BINARY)
+ if (omit_binary_values_ && value->GetType() == Value::Type::BINARY)
continue;
if (first_value_has_been_output) {
@@ -149,7 +149,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_DICTIONARY: {
+ case Value::Type::DICTIONARY: {
json_string_->push_back('{');
if (pretty_print_)
json_string_->append(kPrettyPrintLineEnding);
@@ -161,7 +161,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
for (DictionaryValue::Iterator itr(*dict); !itr.IsAtEnd();
itr.Advance()) {
if (omit_binary_values_ &&
- itr.value().GetType() == Value::TYPE_BINARY) {
+ itr.value().GetType() == Value::Type::BINARY) {
continue;
}
@@ -194,7 +194,7 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) {
return result;
}
- case Value::TYPE_BINARY:
+ case Value::Type::BINARY:
// Successful only if we're allowed to omit it.
DLOG_IF(ERROR, !omit_binary_values_) << "Cannot serialize binary value.";
return omit_binary_values_;
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/test/trace_event_analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698