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

Unified Diff: base/values.h

Issue 8962042: Add TYPE_INTEGER64 type to base::Value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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_writer_unittest.cc ('k') | base/values.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.h
diff --git a/base/values.h b/base/values.h
index 026fcf664b0510c884f08c4368b0aa52c2b229ef..8b78317af69b6a82aee96ebb1b6b815987fdd545 100644
--- a/base/values.h
+++ b/base/values.h
@@ -58,6 +58,7 @@ class BASE_EXPORT Value {
TYPE_NULL = 0,
TYPE_BOOLEAN,
TYPE_INTEGER,
+ TYPE_INTEGER64,
TYPE_DOUBLE,
TYPE_STRING,
TYPE_BINARY,
@@ -73,6 +74,7 @@ class BASE_EXPORT Value {
static Value* CreateNullValue();
static FundamentalValue* CreateBooleanValue(bool in_value);
static FundamentalValue* CreateIntegerValue(int in_value);
+ static FundamentalValue* CreateInteger64Value(int64 in_value);
static FundamentalValue* CreateDoubleValue(double in_value);
static StringValue* CreateStringValue(const std::string& in_value);
static StringValue* CreateStringValue(const string16& in_value);
@@ -91,8 +93,11 @@ class BASE_EXPORT Value {
// If the current setting object can be converted into the given type,
// the value is returned through the |out_value| parameter and true is
// returned; otherwise, false is returned and |out_value| is unchanged.
+ // An integer type can be converted to a double, but the 64-bit integer
+ // cannot.
virtual bool GetAsBoolean(bool* out_value) const;
virtual bool GetAsInteger(int* out_value) const;
+ virtual bool GetAsInteger64(int64* out_value) const;
virtual bool GetAsDouble(double* out_value) const;
virtual bool GetAsString(std::string* out_value) const;
virtual bool GetAsString(string16* out_value) const;
@@ -133,12 +138,14 @@ class BASE_EXPORT FundamentalValue : public Value {
public:
explicit FundamentalValue(bool in_value);
explicit FundamentalValue(int in_value);
+ explicit FundamentalValue(int64 in_value);
explicit FundamentalValue(double in_value);
virtual ~FundamentalValue();
// Overridden from Value:
virtual bool GetAsBoolean(bool* out_value) const OVERRIDE;
virtual bool GetAsInteger(int* out_value) const OVERRIDE;
+ virtual bool GetAsInteger64(int64* out_value) const OVERRIDE;
virtual bool GetAsDouble(double* out_value) const OVERRIDE;
virtual FundamentalValue* DeepCopy() const OVERRIDE;
virtual bool Equals(const Value* other) const OVERRIDE;
@@ -146,7 +153,7 @@ class BASE_EXPORT FundamentalValue : public Value {
private:
union {
bool boolean_value_;
- int integer_value_;
+ int64 integer_value_;
double double_value_;
};
@@ -249,6 +256,7 @@ class BASE_EXPORT DictionaryValue : public Value {
// value at that path, even if it has a different type.
void SetBoolean(const std::string& path, bool in_value);
void SetInteger(const std::string& path, int in_value);
+ void SetInteger64(const std::string& path, int64 in_value);
void SetDouble(const std::string& path, double in_value);
void SetString(const std::string& path, const std::string& in_value);
void SetString(const std::string& path, const string16& in_value);
@@ -271,6 +279,7 @@ class BASE_EXPORT DictionaryValue : public Value {
// the end of the path can be returned in the form specified.
bool GetBoolean(const std::string& path, bool* out_value) const;
bool GetInteger(const std::string& path, int* out_value) const;
+ bool GetInteger64(const std::string& path, int64* out_value) const;
bool GetDouble(const std::string& path, double* out_value) const;
bool GetString(const std::string& path, std::string* out_value) const;
bool GetString(const std::string& path, string16* out_value) const;
@@ -286,6 +295,8 @@ class BASE_EXPORT DictionaryValue : public Value {
Value** out_value) const;
bool GetIntegerWithoutPathExpansion(const std::string& key,
int* out_value) const;
+ bool GetInteger64WithoutPathExpansion(const std::string& key,
+ int64* out_value) const;
bool GetDoubleWithoutPathExpansion(const std::string& key,
double* out_value) const;
bool GetStringWithoutPathExpansion(const std::string& key,
@@ -412,6 +423,7 @@ class BASE_EXPORT ListValue : public Value {
// in the specified form.
bool GetBoolean(size_t index, bool* out_value) const;
bool GetInteger(size_t index, int* out_value) const;
+ bool GetInteger64(size_t index, int64* out_value) const;
bool GetDouble(size_t index, double* out_value) const;
bool GetString(size_t index, std::string* out_value) const;
bool GetString(size_t index, string16* out_value) const;
« no previous file with comments | « base/json/json_writer_unittest.cc ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698