Index: base/values.h |
diff --git a/base/values.h b/base/values.h |
index bfd6a901cb9105672ca69ef770aaf347b7bc7f9a..a24ea228dfed9a8eb387d6321b538dc4d59310f3 100644 |
--- a/base/values.h |
+++ b/base/values.h |
@@ -30,6 +30,7 @@ |
#include "base/base_export.h" |
#include "base/compiler_specific.h" |
#include "base/macros.h" |
+#include "base/memory/manual_constructor.h" |
#include "base/strings/string16.h" |
#include "base/strings/string_piece.h" |
@@ -92,6 +93,9 @@ class BASE_EXPORT Value { |
bool GetBool() const; |
int GetInt() const; |
double GetDouble() const; // Implicitly converts from int if necessary. |
+ // Returns |string_value_| as a pointer or reference. |
+ std::string* GetString(); |
+ const std::string& GetString() const; |
// These methods allow the convenient retrieval of the contents of the Value. |
// If the current object can be converted into the given type, the value is |
@@ -138,6 +142,10 @@ class BASE_EXPORT Value { |
Value(bool in_bool); |
Value(int in_int); |
Value(double in_double); |
+ // TODO(jdoerrie) move to public when StringValue is gone. |
+ Value(const char* in_string); // Value(bool in_bool) shadows otherwise |
+ Value(StringPiece in_string); |
+ Value(const string16& in_string); |
private: |
Type type_; |
@@ -146,6 +154,7 @@ class BASE_EXPORT Value { |
bool bool_value_; |
int int_value_; |
double double_value_; |
+ ManualConstructor<std::string> string_value_; |
}; |
}; |
@@ -159,6 +168,7 @@ class BASE_EXPORT FundamentalValue : public Value { |
~FundamentalValue() override; |
}; |
+// TODO(jdoerrie) remove when callers are updated to use raw Value. |
class BASE_EXPORT StringValue : public Value { |
public: |
// Initializes a StringValue with a UTF-8 narrow character string. |
@@ -168,20 +178,6 @@ class BASE_EXPORT StringValue : public Value { |
explicit StringValue(const string16& in_value); |
~StringValue() override; |
- |
- // Returns |value_| as a pointer or reference. |
- std::string* GetString(); |
- const std::string& GetString() const; |
- |
- // Overridden from Value: |
- bool GetAsString(std::string* out_value) const override; |
- bool GetAsString(string16* out_value) const override; |
- bool GetAsString(const StringValue** out_value) const override; |
- StringValue* DeepCopy() const override; |
- bool Equals(const Value* other) const override; |
- |
- private: |
- std::string value_; |
}; |
class BASE_EXPORT BinaryValue: public Value { |