diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 20:23:43 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 20:23:43 +0000 |
commit | 9989c9bb16d23b11ff55daf8545b76c2eeba3440 (patch) | |
tree | 29637e8e9bb9c56fd04369405de6bfc4e73e151a /base/values.cc | |
parent | 3abebda09095620356405de505db7dd5bb22f3fd (diff) | |
download | chromium_src-9989c9bb16d23b11ff55daf8545b76c2eeba3440.zip chromium_src-9989c9bb16d23b11ff55daf8545b76c2eeba3440.tar.gz chromium_src-9989c9bb16d23b11ff55daf8545b76c2eeba3440.tar.bz2 |
Make the order of methods in the cc files match the headers in base/.
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6189001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values.cc')
-rw-r--r-- | base/values.cc | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/base/values.cc b/base/values.cc index 4553e68..3522569 100644 --- a/base/values.cc +++ b/base/values.cc @@ -263,6 +263,12 @@ bool StringValue::Equals(const Value* other) const { ///////////////////// BinaryValue //////////////////// +BinaryValue::~BinaryValue() { + DCHECK(buffer_); + if (buffer_) + delete[] buffer_; +} + // static BinaryValue* BinaryValue::Create(char* buffer, size_t size) { if (!buffer) @@ -282,20 +288,6 @@ BinaryValue* BinaryValue::CreateWithCopiedBuffer(const char* buffer, return new BinaryValue(buffer_copy, size); } - -BinaryValue::BinaryValue(char* buffer, size_t size) - : Value(TYPE_BINARY), - buffer_(buffer), - size_(size) { - DCHECK(buffer_); -} - -BinaryValue::~BinaryValue() { - DCHECK(buffer_); - if (buffer_) - delete[] buffer_; -} - Value* BinaryValue::DeepCopy() const { return CreateWithCopiedBuffer(buffer_, size_); } @@ -309,6 +301,13 @@ bool BinaryValue::Equals(const Value* other) const { return !memcmp(buffer_, other_binary->buffer_, size_); } +BinaryValue::BinaryValue(char* buffer, size_t size) + : Value(TYPE_BINARY), + buffer_(buffer), + size_(size) { + DCHECK(buffer_); +} + ///////////////////// DictionaryValue //////////////////// DictionaryValue::DictionaryValue() @@ -319,44 +318,6 @@ DictionaryValue::~DictionaryValue() { Clear(); } -Value* DictionaryValue::DeepCopy() const { - DictionaryValue* result = new DictionaryValue; - - for (ValueMap::const_iterator current_entry(dictionary_.begin()); - current_entry != dictionary_.end(); ++current_entry) { - result->SetWithoutPathExpansion(current_entry->first, - current_entry->second->DeepCopy()); - } - - return result; -} - -bool DictionaryValue::Equals(const Value* other) const { - if (other->GetType() != GetType()) - return false; - - const DictionaryValue* other_dict = - static_cast<const DictionaryValue*>(other); - key_iterator lhs_it(begin_keys()); - key_iterator rhs_it(other_dict->begin_keys()); - while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) { - Value* lhs; - Value* rhs; - if (*lhs_it != *rhs_it || - !GetWithoutPathExpansion(*lhs_it, &lhs) || - !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) || - !lhs->Equals(rhs)) { - return false; - } - ++lhs_it; - ++rhs_it; - } - if (lhs_it != end_keys() || rhs_it != other_dict->end_keys()) - return false; - - return true; -} - bool DictionaryValue::HasKey(const std::string& key) const { DCHECK(IsStringUTF8(key)); ValueMap::const_iterator current_entry = dictionary_.find(key); @@ -685,6 +646,44 @@ void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) { } } +Value* DictionaryValue::DeepCopy() const { + DictionaryValue* result = new DictionaryValue; + + for (ValueMap::const_iterator current_entry(dictionary_.begin()); + current_entry != dictionary_.end(); ++current_entry) { + result->SetWithoutPathExpansion(current_entry->first, + current_entry->second->DeepCopy()); + } + + return result; +} + +bool DictionaryValue::Equals(const Value* other) const { + if (other->GetType() != GetType()) + return false; + + const DictionaryValue* other_dict = + static_cast<const DictionaryValue*>(other); + key_iterator lhs_it(begin_keys()); + key_iterator rhs_it(other_dict->begin_keys()); + while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) { + Value* lhs; + Value* rhs; + if (*lhs_it != *rhs_it || + !GetWithoutPathExpansion(*lhs_it, &lhs) || + !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) || + !lhs->Equals(rhs)) { + return false; + } + ++lhs_it; + ++rhs_it; + } + if (lhs_it != end_keys() || rhs_it != other_dict->end_keys()) + return false; + + return true; +} + ///////////////////// ListValue //////////////////// ListValue::ListValue() : Value(TYPE_LIST) { |