summaryrefslogtreecommitdiff
path: root/base/values.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/values.h')
-rw-r--r--base/values.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/base/values.h b/base/values.h
index 35f66df904..95d5d1c2ba 100644
--- a/base/values.h
+++ b/base/values.h
@@ -74,7 +74,7 @@ class BASE_EXPORT Value {
size_t size);
Value(const Value& that);
- Value(Value&& that);
+ Value(Value&& that) noexcept;
Value(); // A null value.
explicit Value(Type type);
explicit Value(bool in_bool);
@@ -161,11 +161,24 @@ class BASE_EXPORT Value {
// Preferred version of DeepCopy. TODO(estade): remove the above.
std::unique_ptr<Value> CreateDeepCopy() const;
+ // Comparison operators so that Values can easily be used with standard
+ // library algorithms and associative containers.
+ BASE_EXPORT friend bool operator==(const Value& lhs, const Value& rhs);
+ BASE_EXPORT friend bool operator!=(const Value& lhs, const Value& rhs);
+ BASE_EXPORT friend bool operator<(const Value& lhs, const Value& rhs);
+ BASE_EXPORT friend bool operator>(const Value& lhs, const Value& rhs);
+ BASE_EXPORT friend bool operator<=(const Value& lhs, const Value& rhs);
+ BASE_EXPORT friend bool operator>=(const Value& lhs, const Value& rhs);
+
// Compares if two Value objects have equal contents.
+ // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead.
+ // TODO(crbug.com/646113): Delete this and migrate callsites.
bool Equals(const Value* other) const;
// Compares if two Value objects have equal contents. Can handle NULLs.
// NULLs are considered equal but different from Value::CreateNullValue().
+ // DEPRECATED, use operator==(const Value& lhs, const Value& rhs) instead.
+ // TODO(crbug.com/646113): Delete this and migrate callsites.
static bool Equals(const Value* a, const Value* b);
protected:
@@ -191,7 +204,6 @@ class BASE_EXPORT Value {
void InternalCopyConstructFrom(const Value& that);
void InternalMoveConstructFrom(Value&& that);
void InternalCopyAssignFromSameType(const Value& that);
- void InternalMoveAssignFromSameType(Value&& that);
void InternalCleanup();
};