| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef JSONValues_h | 31 #ifndef JSONValues_h |
| 32 #define JSONValues_h | 32 #define JSONValues_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
| 37 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 38 #include "wtf/TypeTraits.h" |
| 38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 39 #include "wtf/text/StringHash.h" | 40 #include "wtf/text/StringHash.h" |
| 40 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 45 class JSONValue; |
| 46 |
| 47 } // namespace blink |
| 48 |
| 49 namespace WTF { |
| 50 |
| 51 // FIXME: Avoid the need for this global upcasting to JSONValue (for PassRefPtr<
T>.) |
| 52 // The current CodeGeneratorInspector.py generates code which order sorts its in
put |
| 53 // types and generates forward declarations where needed. But with inline uses |
| 54 // of setValue(PassRefPtr<JSONValue>) this is not quite sufficient for the |
| 55 // implicit conversion of PassRefPtr<T> to PassRefPtr<JSONValue> for a T that |
| 56 // has only been forward declared -- IsPointerConvertible<> doesn't have |
| 57 // complete types to work with. |
| 58 // |
| 59 // Work around that problem here by hackily declaring this global & unsafe |
| 60 // specialization. |
| 61 // |
| 62 // (InspectorTypeBuilder.h is the only piece of code that relies on this special
ization.) |
| 63 template<typename From> class IsPointerConvertible<From, blink::JSONValue> { |
| 64 public: |
| 65 enum { |
| 66 Value = true |
| 67 }; |
| 68 }; |
| 69 |
| 70 } // namespace WTF |
| 71 |
| 72 namespace blink { |
| 73 |
| 44 class JSONArray; | 74 class JSONArray; |
| 45 class JSONObject; | 75 class JSONObject; |
| 46 | 76 |
| 47 class PLATFORM_EXPORT JSONValue : public RefCounted<JSONValue> { | 77 class PLATFORM_EXPORT JSONValue : public RefCounted<JSONValue> { |
| 48 public: | 78 public: |
| 49 static const int maxDepth = 1000; | 79 static const int maxDepth = 1000; |
| 50 | 80 |
| 51 JSONValue() : m_type(TypeNull) { } | 81 JSONValue() : m_type(TypeNull) { } |
| 52 virtual ~JSONValue() { } | 82 virtual ~JSONValue() { } |
| 53 | 83 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 using JSONArrayBase::pushArray; | 339 using JSONArrayBase::pushArray; |
| 310 | 340 |
| 311 using JSONArrayBase::get; | 341 using JSONArrayBase::get; |
| 312 | 342 |
| 313 using JSONArrayBase::begin; | 343 using JSONArrayBase::begin; |
| 314 using JSONArrayBase::end; | 344 using JSONArrayBase::end; |
| 315 }; | 345 }; |
| 316 | 346 |
| 317 } // namespace blink | 347 } // namespace blink |
| 318 | 348 |
| 319 #endif // !defined(JSONValues_h) | 349 #endif // JSONValues_h |
| OLD | NEW |