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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 private: | 155 private: |
156 explicit JSONString(const String& value) : JSONValue(TypeString), m_stringVa
lue(value) { } | 156 explicit JSONString(const String& value) : JSONValue(TypeString), m_stringVa
lue(value) { } |
157 explicit JSONString(const char* value) : JSONValue(TypeString), m_stringValu
e(value) { } | 157 explicit JSONString(const char* value) : JSONValue(TypeString), m_stringValu
e(value) { } |
158 | 158 |
159 String m_stringValue; | 159 String m_stringValue; |
160 }; | 160 }; |
161 | 161 |
162 class PLATFORM_EXPORT JSONObjectBase : public JSONValue { | 162 class PLATFORM_EXPORT JSONObjectBase : public JSONValue { |
163 private: | 163 private: |
164 typedef HashMap<String, RefPtr<JSONValue> > Dictionary; | 164 typedef HashMap<String, RefPtr<JSONValue>> Dictionary; |
165 | 165 |
166 public: | 166 public: |
167 typedef Dictionary::iterator iterator; | 167 typedef Dictionary::iterator iterator; |
168 typedef Dictionary::const_iterator const_iterator; | 168 typedef Dictionary::const_iterator const_iterator; |
169 | 169 |
170 virtual PassRefPtr<JSONObject> asObject() override; | 170 virtual PassRefPtr<JSONObject> asObject() override; |
171 JSONObject* openAccessors(); | 171 JSONObject* openAccessors(); |
172 | 172 |
173 virtual void writeJSON(StringBuilder* output) const override; | 173 virtual void writeJSON(StringBuilder* output) const override; |
174 | 174 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 using JSONObjectBase::begin; | 247 using JSONObjectBase::begin; |
248 using JSONObjectBase::end; | 248 using JSONObjectBase::end; |
249 | 249 |
250 using JSONObjectBase::size; | 250 using JSONObjectBase::size; |
251 }; | 251 }; |
252 | 252 |
253 | 253 |
254 class PLATFORM_EXPORT JSONArrayBase : public JSONValue { | 254 class PLATFORM_EXPORT JSONArrayBase : public JSONValue { |
255 public: | 255 public: |
256 typedef Vector<RefPtr<JSONValue> >::iterator iterator; | 256 typedef Vector<RefPtr<JSONValue>>::iterator iterator; |
257 typedef Vector<RefPtr<JSONValue> >::const_iterator const_iterator; | 257 typedef Vector<RefPtr<JSONValue>>::const_iterator const_iterator; |
258 | 258 |
259 virtual PassRefPtr<JSONArray> asArray() override; | 259 virtual PassRefPtr<JSONArray> asArray() override; |
260 | 260 |
261 unsigned length() const { return m_data.size(); } | 261 unsigned length() const { return m_data.size(); } |
262 | 262 |
263 virtual void writeJSON(StringBuilder* output) const override; | 263 virtual void writeJSON(StringBuilder* output) const override; |
264 | 264 |
265 protected: | 265 protected: |
266 virtual ~JSONArrayBase(); | 266 virtual ~JSONArrayBase(); |
267 | 267 |
(...skipping 13 matching lines...) Expand all Loading... |
281 | 281 |
282 iterator begin() { return m_data.begin(); } | 282 iterator begin() { return m_data.begin(); } |
283 iterator end() { return m_data.end(); } | 283 iterator end() { return m_data.end(); } |
284 const_iterator begin() const { return m_data.begin(); } | 284 const_iterator begin() const { return m_data.begin(); } |
285 const_iterator end() const { return m_data.end(); } | 285 const_iterator end() const { return m_data.end(); } |
286 | 286 |
287 protected: | 287 protected: |
288 JSONArrayBase(); | 288 JSONArrayBase(); |
289 | 289 |
290 private: | 290 private: |
291 Vector<RefPtr<JSONValue> > m_data; | 291 Vector<RefPtr<JSONValue>> m_data; |
292 }; | 292 }; |
293 | 293 |
294 class PLATFORM_EXPORT JSONArray : public JSONArrayBase { | 294 class PLATFORM_EXPORT JSONArray : public JSONArrayBase { |
295 public: | 295 public: |
296 static PassRefPtr<JSONArray> create() | 296 static PassRefPtr<JSONArray> create() |
297 { | 297 { |
298 return adoptRef(new JSONArray()); | 298 return adoptRef(new JSONArray()); |
299 } | 299 } |
300 | 300 |
301 using JSONArrayBase::asArray; | 301 using JSONArrayBase::asArray; |
302 | 302 |
303 using JSONArrayBase::pushBoolean; | 303 using JSONArrayBase::pushBoolean; |
304 using JSONArrayBase::pushInt; | 304 using JSONArrayBase::pushInt; |
305 using JSONArrayBase::pushNumber; | 305 using JSONArrayBase::pushNumber; |
306 using JSONArrayBase::pushString; | 306 using JSONArrayBase::pushString; |
307 using JSONArrayBase::pushValue; | 307 using JSONArrayBase::pushValue; |
308 using JSONArrayBase::pushObject; | 308 using JSONArrayBase::pushObject; |
309 using JSONArrayBase::pushArray; | 309 using JSONArrayBase::pushArray; |
310 | 310 |
311 using JSONArrayBase::get; | 311 using JSONArrayBase::get; |
312 | 312 |
313 using JSONArrayBase::begin; | 313 using JSONArrayBase::begin; |
314 using JSONArrayBase::end; | 314 using JSONArrayBase::end; |
315 }; | 315 }; |
316 | 316 |
317 } // namespace blink | 317 } // namespace blink |
318 | 318 |
319 #endif // !defined(JSONValues_h) | 319 #endif // !defined(JSONValues_h) |
OLD | NEW |