| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/json/json_parser.h" | 5 #include "base/json/json_parser.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 // Overridden from Value: | 145 // Overridden from Value: |
| 146 bool GetAsString(std::string* out_value) const override { | 146 bool GetAsString(std::string* out_value) const override { |
| 147 string_piece_.CopyToString(out_value); | 147 string_piece_.CopyToString(out_value); |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 bool GetAsString(string16* out_value) const override { | 150 bool GetAsString(string16* out_value) const override { |
| 151 *out_value = UTF8ToUTF16(string_piece_); | 151 *out_value = UTF8ToUTF16(string_piece_); |
| 152 return true; | 152 return true; |
| 153 } | 153 } |
| 154 bool GetAsString(StringPiece* out_value) const override { |
| 155 *out_value = string_piece_; |
| 156 return true; |
| 157 } |
| 154 Value* DeepCopy() const override { return new StringValue(string_piece_); } | 158 Value* DeepCopy() const override { return new StringValue(string_piece_); } |
| 155 bool Equals(const Value* other) const override { | 159 bool Equals(const Value* other) const override { |
| 156 std::string other_string; | 160 std::string other_string; |
| 157 return other->IsType(Type::STRING) && other->GetAsString(&other_string) && | 161 return other->IsType(Type::STRING) && other->GetAsString(&other_string) && |
| 158 StringPiece(other_string) == string_piece_; | 162 StringPiece(other_string) == string_piece_; |
| 159 } | 163 } |
| 160 | 164 |
| 161 private: | 165 private: |
| 162 // The location in the original input stream. | 166 // The location in the original input stream. |
| 163 StringPiece string_piece_; | 167 StringPiece string_piece_; |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 const std::string& description) { | 993 const std::string& description) { |
| 990 if (line || column) { | 994 if (line || column) { |
| 991 return StringPrintf("Line: %i, column: %i, %s", | 995 return StringPrintf("Line: %i, column: %i, %s", |
| 992 line, column, description.c_str()); | 996 line, column, description.c_str()); |
| 993 } | 997 } |
| 994 return description; | 998 return description; |
| 995 } | 999 } |
| 996 | 1000 |
| 997 } // namespace internal | 1001 } // namespace internal |
| 998 } // namespace base | 1002 } // namespace base |
| OLD | NEW |