| 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" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class DebuggerEvent; |
| 14 class Field; | 15 class Field; |
| 15 class GrowableObjectArray; | 16 class GrowableObjectArray; |
| 16 class Instance; | 17 class Instance; |
| 17 class JSONArray; | 18 class JSONArray; |
| 18 class JSONObject; | 19 class JSONObject; |
| 19 class Object; | 20 class Object; |
| 20 class SourceBreakpoint; | 21 class SourceBreakpoint; |
| 21 class Zone; | 22 class Zone; |
| 22 | 23 |
| 23 class JSONStream : ValueObject { | 24 class JSONStream : ValueObject { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void CloseArray(); | 78 void CloseArray(); |
| 78 | 79 |
| 79 void PrintValueBool(bool b); | 80 void PrintValueBool(bool b); |
| 80 void PrintValue(intptr_t i); | 81 void PrintValue(intptr_t i); |
| 81 void PrintValue64(int64_t i); | 82 void PrintValue64(int64_t i); |
| 82 void PrintValue(double d); | 83 void PrintValue(double d); |
| 83 void PrintValue(const char* s); | 84 void PrintValue(const char* s); |
| 84 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 85 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 85 void PrintValue(const Object& o, bool ref = true); | 86 void PrintValue(const Object& o, bool ref = true); |
| 86 void PrintValue(SourceBreakpoint* bpt); | 87 void PrintValue(SourceBreakpoint* bpt); |
| 88 void PrintValue(const DebuggerEvent* event); |
| 87 void PrintValue(Isolate* isolate, bool ref = true); | 89 void PrintValue(Isolate* isolate, bool ref = true); |
| 88 | 90 |
| 89 void PrintPropertyBool(const char* name, bool b); | 91 void PrintPropertyBool(const char* name, bool b); |
| 90 void PrintProperty(const char* name, intptr_t i); | 92 void PrintProperty(const char* name, intptr_t i); |
| 91 void PrintProperty64(const char* name, int64_t i); | 93 void PrintProperty64(const char* name, int64_t i); |
| 92 void PrintProperty(const char* name, double d); | 94 void PrintProperty(const char* name, double d); |
| 93 void PrintProperty(const char* name, const char* s); | 95 void PrintProperty(const char* name, const char* s); |
| 94 void PrintfProperty(const char* name, const char* format, ...) | 96 void PrintfProperty(const char* name, const char* format, ...) |
| 95 PRINTF_ATTRIBUTE(3, 4); | 97 PRINTF_ATTRIBUTE(3, 4); |
| 96 void PrintProperty(const char* name, const Object& o, bool ref = true); | 98 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 97 | 99 |
| 100 void PrintProperty(const char* name, const DebuggerEvent* event); |
| 101 void PrintProperty(const char* name, Isolate* isolate); |
| 98 void PrintPropertyName(const char* name); | 102 void PrintPropertyName(const char* name); |
| 99 void PrintCommaIfNeeded(); | 103 void PrintCommaIfNeeded(); |
| 100 bool NeedComma(); | 104 bool NeedComma(); |
| 101 | 105 |
| 102 void AddEscapedUTF8String(const char* s); | 106 void AddEscapedUTF8String(const char* s); |
| 103 | 107 |
| 104 intptr_t nesting_level() const { return open_objects_; } | 108 intptr_t nesting_level() const { return open_objects_; } |
| 105 | 109 |
| 106 intptr_t open_objects_; | 110 intptr_t open_objects_; |
| 107 TextBuffer buffer_; | 111 TextBuffer buffer_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 148 } |
| 145 void AddProperty(const char* name, double d) const { | 149 void AddProperty(const char* name, double d) const { |
| 146 stream_->PrintProperty(name, d); | 150 stream_->PrintProperty(name, d); |
| 147 } | 151 } |
| 148 void AddProperty(const char* name, const char* s) const { | 152 void AddProperty(const char* name, const char* s) const { |
| 149 stream_->PrintProperty(name, s); | 153 stream_->PrintProperty(name, s); |
| 150 } | 154 } |
| 151 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 155 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
| 152 stream_->PrintProperty(name, obj, ref); | 156 stream_->PrintProperty(name, obj, ref); |
| 153 } | 157 } |
| 158 void AddProperty(const char* name, const DebuggerEvent* event) const { |
| 159 stream_->PrintProperty(name, event); |
| 160 } |
| 161 void AddProperty(const char* name, Isolate* isolate) const { |
| 162 stream_->PrintProperty(name, isolate); |
| 163 } |
| 154 void AddPropertyF(const char* name, const char* format, ...) const | 164 void AddPropertyF(const char* name, const char* format, ...) const |
| 155 PRINTF_ATTRIBUTE(3, 4); | 165 PRINTF_ATTRIBUTE(3, 4); |
| 156 | 166 |
| 157 private: | 167 private: |
| 158 JSONStream* stream_; | 168 JSONStream* stream_; |
| 159 | 169 |
| 160 friend class JSONArray; | 170 friend class JSONArray; |
| 161 | 171 |
| 162 DISALLOW_ALLOCATION(); | 172 DISALLOW_ALLOCATION(); |
| 163 DISALLOW_COPY_AND_ASSIGN(JSONObject); | 173 DISALLOW_COPY_AND_ASSIGN(JSONObject); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 186 void AddValue(const char* s) const { stream_->PrintValue(s); } | 196 void AddValue(const char* s) const { stream_->PrintValue(s); } |
| 187 void AddValue(const Object& obj, bool ref = true) const { | 197 void AddValue(const Object& obj, bool ref = true) const { |
| 188 stream_->PrintValue(obj, ref); | 198 stream_->PrintValue(obj, ref); |
| 189 } | 199 } |
| 190 void AddValue(Isolate* isolate, bool ref = true) const { | 200 void AddValue(Isolate* isolate, bool ref = true) const { |
| 191 stream_->PrintValue(isolate, ref); | 201 stream_->PrintValue(isolate, ref); |
| 192 } | 202 } |
| 193 void AddValue(SourceBreakpoint* bpt) const { | 203 void AddValue(SourceBreakpoint* bpt) const { |
| 194 stream_->PrintValue(bpt); | 204 stream_->PrintValue(bpt); |
| 195 } | 205 } |
| 206 void AddValue(const DebuggerEvent* event) const { |
| 207 stream_->PrintValue(event); |
| 208 } |
| 196 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 209 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 197 | 210 |
| 198 private: | 211 private: |
| 199 JSONStream* stream_; | 212 JSONStream* stream_; |
| 200 | 213 |
| 201 friend class JSONObject; | 214 friend class JSONObject; |
| 202 | 215 |
| 203 DISALLOW_ALLOCATION(); | 216 DISALLOW_ALLOCATION(); |
| 204 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 217 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 205 }; | 218 }; |
| 206 | 219 |
| 207 } // namespace dart | 220 } // namespace dart |
| 208 | 221 |
| 209 #endif // VM_JSON_STREAM_H_ | 222 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |