| 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 "include/dart_api.h" // for Dart_Port | 8 #include "include/dart_api.h" // for Dart_Port |
| 9 #include "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void Clear(); | 65 void Clear(); |
| 66 | 66 |
| 67 void OpenObject(const char* property_name = NULL); | 67 void OpenObject(const char* property_name = NULL); |
| 68 void CloseObject(); | 68 void CloseObject(); |
| 69 | 69 |
| 70 void OpenArray(const char* property_name = NULL); | 70 void OpenArray(const char* property_name = NULL); |
| 71 void CloseArray(); | 71 void CloseArray(); |
| 72 | 72 |
| 73 void PrintValueBool(bool b); | 73 void PrintValueBool(bool b); |
| 74 void PrintValue(intptr_t i); | 74 void PrintValue(intptr_t i); |
| 75 void PrintValue64(int64_t i); |
| 75 void PrintValue(double d); | 76 void PrintValue(double d); |
| 76 void PrintValue(const char* s); | 77 void PrintValue(const char* s); |
| 77 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 78 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 78 void PrintValue(const Object& o, bool ref = true); | 79 void PrintValue(const Object& o, bool ref = true); |
| 79 void PrintValue(SourceBreakpoint* bpt); | 80 void PrintValue(SourceBreakpoint* bpt); |
| 80 | 81 |
| 81 void PrintPropertyBool(const char* name, bool b); | 82 void PrintPropertyBool(const char* name, bool b); |
| 82 void PrintProperty(const char* name, intptr_t i); | 83 void PrintProperty(const char* name, intptr_t i); |
| 84 void PrintProperty64(const char* name, int64_t i); |
| 83 void PrintProperty(const char* name, double d); | 85 void PrintProperty(const char* name, double d); |
| 84 void PrintProperty(const char* name, const char* s); | 86 void PrintProperty(const char* name, const char* s); |
| 85 void PrintfProperty(const char* name, const char* format, ...) | 87 void PrintfProperty(const char* name, const char* format, ...) |
| 86 PRINTF_ATTRIBUTE(3, 4); | 88 PRINTF_ATTRIBUTE(3, 4); |
| 87 void PrintProperty(const char* name, const Object& o, bool ref = true); | 89 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 88 | 90 |
| 89 void PrintPropertyName(const char* name); | 91 void PrintPropertyName(const char* name); |
| 90 void PrintCommaIfNeeded(); | 92 void PrintCommaIfNeeded(); |
| 91 bool NeedComma(); | 93 bool NeedComma(); |
| 92 | 94 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 121 ~JSONObject() { | 123 ~JSONObject() { |
| 122 stream_->CloseObject(); | 124 stream_->CloseObject(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void AddProperty(const char* name, bool b) const { | 127 void AddProperty(const char* name, bool b) const { |
| 126 stream_->PrintPropertyBool(name, b); | 128 stream_->PrintPropertyBool(name, b); |
| 127 } | 129 } |
| 128 void AddProperty(const char* name, intptr_t i) const { | 130 void AddProperty(const char* name, intptr_t i) const { |
| 129 stream_->PrintProperty(name, i); | 131 stream_->PrintProperty(name, i); |
| 130 } | 132 } |
| 133 void AddProperty64(const char* name, int64_t i) const { |
| 134 stream_->PrintProperty64(name, i); |
| 135 } |
| 131 void AddProperty(const char* name, double d) const { | 136 void AddProperty(const char* name, double d) const { |
| 132 stream_->PrintProperty(name, d); | 137 stream_->PrintProperty(name, d); |
| 133 } | 138 } |
| 134 void AddProperty(const char* name, const char* s) const { | 139 void AddProperty(const char* name, const char* s) const { |
| 135 stream_->PrintProperty(name, s); | 140 stream_->PrintProperty(name, s); |
| 136 } | 141 } |
| 137 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 142 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
| 138 stream_->PrintProperty(name, obj, ref); | 143 stream_->PrintProperty(name, obj, ref); |
| 139 } | 144 } |
| 140 void AddPropertyF(const char* name, const char* format, ...) const | 145 void AddPropertyF(const char* name, const char* format, ...) const |
| (...skipping 19 matching lines...) Expand all Loading... |
| 160 } | 165 } |
| 161 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { | 166 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { |
| 162 stream_->OpenArray(); | 167 stream_->OpenArray(); |
| 163 } | 168 } |
| 164 ~JSONArray() { | 169 ~JSONArray() { |
| 165 stream_->CloseArray(); | 170 stream_->CloseArray(); |
| 166 } | 171 } |
| 167 | 172 |
| 168 void AddValue(bool b) const { stream_->PrintValueBool(b); } | 173 void AddValue(bool b) const { stream_->PrintValueBool(b); } |
| 169 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 174 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
| 175 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } |
| 170 void AddValue(double d) const { stream_->PrintValue(d); } | 176 void AddValue(double d) const { stream_->PrintValue(d); } |
| 171 void AddValue(const char* s) const { stream_->PrintValue(s); } | 177 void AddValue(const char* s) const { stream_->PrintValue(s); } |
| 172 void AddValue(const Object& obj, bool ref = true) const { | 178 void AddValue(const Object& obj, bool ref = true) const { |
| 173 stream_->PrintValue(obj, ref); | 179 stream_->PrintValue(obj, ref); |
| 174 } | 180 } |
| 175 void AddValue(SourceBreakpoint* bpt) const { | 181 void AddValue(SourceBreakpoint* bpt) const { |
| 176 stream_->PrintValue(bpt); | 182 stream_->PrintValue(bpt); |
| 177 } | 183 } |
| 178 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 184 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 179 | 185 |
| 180 private: | 186 private: |
| 181 JSONStream* stream_; | 187 JSONStream* stream_; |
| 182 | 188 |
| 183 friend class JSONObject; | 189 friend class JSONObject; |
| 184 | 190 |
| 185 DISALLOW_ALLOCATION(); | 191 DISALLOW_ALLOCATION(); |
| 186 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 192 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 187 }; | 193 }; |
| 188 | 194 |
| 189 } // namespace dart | 195 } // namespace dart |
| 190 | 196 |
| 191 #endif // VM_JSON_STREAM_H_ | 197 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |