| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_JSON_STREAM_H_ | 5 #ifndef VM_JSON_STREAM_H_ |
| 6 #define VM_JSON_STREAM_H_ | 6 #define VM_JSON_STREAM_H_ |
| 7 | 7 |
| 8 #include "platform/json.h" | 8 #include "platform/json.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 | 118 |
| 119 class JSONArray : public ValueObject { | 119 class JSONArray : public ValueObject { |
| 120 public: | 120 public: |
| 121 explicit JSONArray(JSONStream* stream) : stream_(stream) { | 121 explicit JSONArray(JSONStream* stream) : stream_(stream) { |
| 122 stream_->OpenArray(); | 122 stream_->OpenArray(); |
| 123 } | 123 } |
| 124 JSONArray(const JSONObject& obj, const char* name) : stream_(obj.stream_) { | 124 JSONArray(const JSONObject& obj, const char* name) : stream_(obj.stream_) { |
| 125 stream_->OpenArray(name); | 125 stream_->OpenArray(name); |
| 126 } | 126 } |
| 127 JSONArray(const JSONArray& arr) : stream_(arr.stream_) { | 127 explicit JSONArray(const JSONArray& arr) : stream_(arr.stream_) { |
| 128 stream_->OpenArray(); | 128 stream_->OpenArray(); |
| 129 } | 129 } |
| 130 ~JSONArray() { | 130 ~JSONArray() { |
| 131 stream_->CloseArray(); | 131 stream_->CloseArray(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void AddValue(bool b) const { stream_->PrintValueBool(b); } | 134 void AddValue(bool b) const { stream_->PrintValueBool(b); } |
| 135 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 135 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
| 136 void AddValue(double d) const { stream_->PrintValue(d); } | 136 void AddValue(double d) const { stream_->PrintValue(d); } |
| 137 void AddValue(const char* s) const { stream_->PrintValue(s); } | 137 void AddValue(const char* s) const { stream_->PrintValue(s); } |
| 138 void AddValue(const Object& obj, bool ref = true) const { | 138 void AddValue(const Object& obj, bool ref = true) const { |
| 139 stream_->PrintValue(obj, ref); | 139 stream_->PrintValue(obj, ref); |
| 140 } | 140 } |
| 141 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 141 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 JSONStream* stream_; | 144 JSONStream* stream_; |
| 145 | 145 |
| 146 friend class JSONObject; | 146 friend class JSONObject; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace dart | 149 } // namespace dart |
| 150 | 150 |
| 151 #endif // VM_JSON_STREAM_H_ | 151 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |