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 // This file specifies a recursive data storage class called Value intended for | 5 // This file specifies a recursive data storage class called Value intended for |
6 // storing setting and other persistable data. It includes the ability to | 6 // storing setting and other persistable data. It includes the ability to |
7 // specify (recursive) lists and dictionaries, so it's fairly expressive. | 7 // specify (recursive) lists and dictionaries, so it's fairly expressive. |
8 // However, the API is optimized for the common case, namely storing a | 8 // However, the API is optimized for the common case, namely storing a |
9 // hierarchical tree of simple values. Given a DictionaryValue root, you can | 9 // hierarchical tree of simple values. Given a DictionaryValue root, you can |
10 // easily do things like: | 10 // easily do things like: |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 174 |
175 DISALLOW_COPY_AND_ASSIGN(StringValue); | 175 DISALLOW_COPY_AND_ASSIGN(StringValue); |
176 }; | 176 }; |
177 | 177 |
178 class BASE_EXPORT BinaryValue: public Value { | 178 class BASE_EXPORT BinaryValue: public Value { |
179 public: | 179 public: |
180 virtual ~BinaryValue(); | 180 virtual ~BinaryValue(); |
181 | 181 |
182 // Creates a Value to represent a binary buffer. The new object takes | 182 // Creates a Value to represent a binary buffer. The new object takes |
183 // ownership of the pointer passed in, if successful. | 183 // ownership of the pointer passed in, if successful. |
184 // Returns NULL if buffer is NULL. | |
185 static BinaryValue* Create(char* buffer, size_t size); | 184 static BinaryValue* Create(char* buffer, size_t size); |
asargent_no_longer_on_chrome
2012/05/11 21:22:46
Instead of just changing the behavior of the Creat
| |
186 | 185 |
187 // For situations where you want to keep ownership of your buffer, this | 186 // For situations where you want to keep ownership of your buffer, this |
188 // factory method creates a new BinaryValue by copying the contents of the | 187 // factory method creates a new BinaryValue by copying the contents of the |
189 // buffer that's passed in. | 188 // buffer that's passed in. |
190 // Returns NULL if buffer is NULL. | |
191 static BinaryValue* CreateWithCopiedBuffer(const char* buffer, size_t size); | 189 static BinaryValue* CreateWithCopiedBuffer(const char* buffer, size_t size); |
192 | 190 |
193 size_t GetSize() const { return size_; } | 191 size_t GetSize() const { return size_; } |
194 char* GetBuffer() { return buffer_; } | 192 char* GetBuffer() { return buffer_; } |
195 const char* GetBuffer() const { return buffer_; } | 193 const char* GetBuffer() const { return buffer_; } |
196 | 194 |
197 // Overridden from Value: | 195 // Overridden from Value: |
198 virtual BinaryValue* DeepCopy() const OVERRIDE; | 196 virtual BinaryValue* DeepCopy() const OVERRIDE; |
199 virtual bool Equals(const Value* other) const OVERRIDE; | 197 virtual bool Equals(const Value* other) const OVERRIDE; |
200 | 198 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 | 490 |
493 } // namespace base | 491 } // namespace base |
494 | 492 |
495 // http://crbug.com/88666 | 493 // http://crbug.com/88666 |
496 using base::DictionaryValue; | 494 using base::DictionaryValue; |
497 using base::ListValue; | 495 using base::ListValue; |
498 using base::StringValue; | 496 using base::StringValue; |
499 using base::Value; | 497 using base::Value; |
500 | 498 |
501 #endif // BASE_VALUES_H_ | 499 #endif // BASE_VALUES_H_ |
OLD | NEW |