Index: base/values.h |
diff --git a/base/values.h b/base/values.h |
index 21c3f5fb5cfcd64cc81569057c74f4b11d0cdafa..14a02e4077ea3ea7cad83a9ee1275360c033fbc1 100644 |
--- a/base/values.h |
+++ b/base/values.h |
@@ -49,15 +49,15 @@ class Value; |
// See the file-level comment above for more information. |
class BASE_EXPORT Value { |
public: |
- enum Type { |
- TYPE_NULL = 0, |
- TYPE_BOOLEAN, |
- TYPE_INTEGER, |
- TYPE_DOUBLE, |
- TYPE_STRING, |
- TYPE_BINARY, |
- TYPE_DICTIONARY, |
- TYPE_LIST |
+ enum class Type { |
+ NONE = 0, |
+ BOOLEAN, |
+ INTEGER, |
+ DOUBLE, |
+ STRING, |
+ BINARY, |
+ DICTIONARY, |
+ LIST |
// Note: Do not add more types. See the file-level comment above for why. |
}; |
@@ -134,7 +134,7 @@ class BASE_EXPORT FundamentalValue : public Value { |
// Overridden from Value: |
bool GetAsBoolean(bool* out_value) const override; |
bool GetAsInteger(int* out_value) const override; |
- // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as |
+ // Values of both type Type::INTEGER and Type::DOUBLE can be obtained as |
// doubles. |
bool GetAsDouble(double* out_value) const override; |
FundamentalValue* DeepCopy() const override; |
@@ -287,7 +287,7 @@ class BASE_EXPORT DictionaryValue : public Value { |
// |out_value| is optional and will only be set if non-NULL. |
bool GetBoolean(StringPiece path, bool* out_value) const; |
bool GetInteger(StringPiece path, int* out_value) const; |
- // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as |
+ // Values of both type Type::INTEGER and Type::DOUBLE can be obtained as |
// doubles. |
bool GetDouble(StringPiece path, double* out_value) const; |
bool GetString(StringPiece path, std::string* out_value) const; |
@@ -427,7 +427,7 @@ class BASE_EXPORT ListValue : public Value { |
// |out_value| is optional and will only be set if non-NULL. |
bool GetBoolean(size_t index, bool* out_value) const; |
bool GetInteger(size_t index, int* out_value) const; |
- // Values of both type TYPE_INTEGER and TYPE_DOUBLE can be obtained as |
+ // Values of both type Type::INTEGER and Type::DOUBLE can be obtained as |
// doubles. |
bool GetDouble(size_t index, double* out_value) const; |
bool GetString(size_t index, std::string* out_value) const; |
@@ -562,6 +562,10 @@ BASE_EXPORT inline std::ostream& operator<<(std::ostream& out, |
return out << static_cast<const Value&>(value); |
} |
+// Stream operator so that enum class Types can be used in log statements. |
+BASE_EXPORT std::ostream& operator<<(std::ostream& out, |
+ const Value::Type& type); |
+ |
} // namespace base |
#endif // BASE_VALUES_H_ |