OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
39 #include "wtf/TypeTraits.h" | 39 #include "wtf/TypeTraits.h" |
40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
41 #include "wtf/text/StringHash.h" | 41 #include "wtf/text/StringHash.h" |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 | 43 |
44 #include <memory> | 44 #include <memory> |
| 45 #include <utility> |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 | 48 |
48 class JSONValue; | 49 class JSONValue; |
49 | 50 |
50 } // namespace blink | 51 } // namespace blink |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 class JSONArray; | 55 class JSONArray; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 std::unique_ptr<JSONValue> clone() const override; | 263 std::unique_ptr<JSONValue> clone() const override; |
263 | 264 |
264 void pushBoolean(bool); | 265 void pushBoolean(bool); |
265 void pushInteger(int); | 266 void pushInteger(int); |
266 void pushDouble(double); | 267 void pushDouble(double); |
267 void pushString(const String&); | 268 void pushString(const String&); |
268 void pushValue(std::unique_ptr<JSONValue>); | 269 void pushValue(std::unique_ptr<JSONValue>); |
269 void pushObject(std::unique_ptr<JSONObject>); | 270 void pushObject(std::unique_ptr<JSONObject>); |
270 void pushArray(std::unique_ptr<JSONArray>); | 271 void pushArray(std::unique_ptr<JSONArray>); |
271 | 272 |
272 JSONValue* at(size_t index); | 273 JSONValue* at(size_t index) const; |
273 size_t size() const { return m_data.size(); } | 274 size_t size() const { return m_data.size(); } |
274 | 275 |
275 protected: | 276 protected: |
276 void prettyWriteJSONInternal(StringBuilder* output, int depth) const override; | 277 void prettyWriteJSONInternal(StringBuilder* output, int depth) const override; |
277 | 278 |
278 private: | 279 private: |
279 JSONArray(); | 280 JSONArray(); |
280 Vector<std::unique_ptr<JSONValue>> m_data; | 281 Vector<std::unique_ptr<JSONValue>> m_data; |
281 }; | 282 }; |
282 | 283 |
283 PLATFORM_EXPORT void escapeStringForJSON(const String&, StringBuilder*); | 284 PLATFORM_EXPORT void escapeStringForJSON(const String&, StringBuilder*); |
284 void doubleQuoteStringForJSON(const String&, StringBuilder*); | 285 void doubleQuoteStringForJSON(const String&, StringBuilder*); |
285 | 286 |
286 } // namespace blink | 287 } // namespace blink |
287 | 288 |
288 #endif // JSONValues_h | 289 #endif // JSONValues_h |
OLD | NEW |