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 #include "vm/service.h" | 11 #include "vm/service.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 class Array; | 15 class Array; |
16 class Field; | 16 class Field; |
17 class GrowableObjectArray; | 17 class GrowableObjectArray; |
18 class Instance; | 18 class Instance; |
19 class JSONArray; | 19 class JSONArray; |
20 class JSONObject; | 20 class JSONObject; |
21 class MessageQueue; | 21 class MessageQueue; |
22 class Metric; | 22 class Metric; |
23 class Object; | 23 class Object; |
24 class ServiceEvent; | 24 class ServiceEvent; |
25 class Breakpoint; | 25 class SourceBreakpoint; |
26 class String; | 26 class String; |
27 class Zone; | 27 class Zone; |
28 | 28 |
29 | 29 |
30 enum JSONRpcErrorCode { | 30 enum JSONRpcErrorCode { |
31 kParseError = -32700, | 31 kParseError = -32700, |
32 kInvalidRequest = -32600, | 32 kInvalidRequest = -32600, |
33 kMethodNotFound = -32601, | 33 kMethodNotFound = -32601, |
34 kInvalidParams = -32602, | 34 kInvalidParams = -32602, |
35 kInternalError = -32603, | 35 kInternalError = -32603, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void PrintValueBool(bool b); | 109 void PrintValueBool(bool b); |
110 void PrintValue(intptr_t i); | 110 void PrintValue(intptr_t i); |
111 void PrintValue64(int64_t i); | 111 void PrintValue64(int64_t i); |
112 void PrintValue(double d); | 112 void PrintValue(double d); |
113 void PrintValue(const char* s); | 113 void PrintValue(const char* s); |
114 void PrintValue(const char* s, intptr_t len); | 114 void PrintValue(const char* s, intptr_t len); |
115 void PrintValueNoEscape(const char* s); | 115 void PrintValueNoEscape(const char* s); |
116 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 116 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
117 void PrintValue(const Object& o, bool ref = true); | 117 void PrintValue(const Object& o, bool ref = true); |
118 void PrintValue(Breakpoint* bpt); | 118 void PrintValue(SourceBreakpoint* bpt); |
119 void PrintValue(const ServiceEvent* event); | 119 void PrintValue(const ServiceEvent* event); |
120 void PrintValue(Metric* metric); | 120 void PrintValue(Metric* metric); |
121 void PrintValue(MessageQueue* queue); | 121 void PrintValue(MessageQueue* queue); |
122 void PrintValue(Isolate* isolate, bool ref = true); | 122 void PrintValue(Isolate* isolate, bool ref = true); |
123 bool PrintValueStr(const String& s, intptr_t limit); | 123 bool PrintValueStr(const String& s, intptr_t limit); |
124 | 124 |
125 void PrintServiceId(const char* name, const Object& o); | 125 void PrintServiceId(const char* name, const Object& o); |
126 void PrintPropertyBool(const char* name, bool b); | 126 void PrintPropertyBool(const char* name, bool b); |
127 void PrintProperty(const char* name, intptr_t i); | 127 void PrintProperty(const char* name, intptr_t i); |
128 void PrintProperty64(const char* name, int64_t i); | 128 void PrintProperty64(const char* name, int64_t i); |
129 void PrintProperty(const char* name, double d); | 129 void PrintProperty(const char* name, double d); |
130 void PrintProperty(const char* name, const char* s); | 130 void PrintProperty(const char* name, const char* s); |
131 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 131 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
132 void PrintPropertyNoEscape(const char* name, const char* s); | 132 void PrintPropertyNoEscape(const char* name, const char* s); |
133 void PrintfProperty(const char* name, const char* format, ...) | 133 void PrintfProperty(const char* name, const char* format, ...) |
134 PRINTF_ATTRIBUTE(3, 4); | 134 PRINTF_ATTRIBUTE(3, 4); |
135 void PrintProperty(const char* name, const Object& o, bool ref = true); | 135 void PrintProperty(const char* name, const Object& o, bool ref = true); |
136 | 136 |
137 void PrintProperty(const char* name, const ServiceEvent* event); | 137 void PrintProperty(const char* name, const ServiceEvent* event); |
138 void PrintProperty(const char* name, Breakpoint* bpt); | 138 void PrintProperty(const char* name, SourceBreakpoint* bpt); |
139 void PrintProperty(const char* name, Metric* metric); | 139 void PrintProperty(const char* name, Metric* metric); |
140 void PrintProperty(const char* name, MessageQueue* queue); | 140 void PrintProperty(const char* name, MessageQueue* queue); |
141 void PrintProperty(const char* name, Isolate* isolate); | 141 void PrintProperty(const char* name, Isolate* isolate); |
142 void PrintPropertyName(const char* name); | 142 void PrintPropertyName(const char* name); |
143 void PrintCommaIfNeeded(); | 143 void PrintCommaIfNeeded(); |
144 bool NeedComma(); | 144 bool NeedComma(); |
145 | 145 |
146 bool AddDartString(const String& s, intptr_t limit); | 146 bool AddDartString(const String& s, intptr_t limit); |
147 void AddEscapedUTF8String(const char* s); | 147 void AddEscapedUTF8String(const char* s); |
148 void AddEscapedUTF8String(const char* s, intptr_t len); | 148 void AddEscapedUTF8String(const char* s, intptr_t len); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 207 } |
208 void AddPropertyNoEscape(const char* name, const char* s) const { | 208 void AddPropertyNoEscape(const char* name, const char* s) const { |
209 stream_->PrintPropertyNoEscape(name, s); | 209 stream_->PrintPropertyNoEscape(name, s); |
210 } | 210 } |
211 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 211 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
212 stream_->PrintProperty(name, obj, ref); | 212 stream_->PrintProperty(name, obj, ref); |
213 } | 213 } |
214 void AddProperty(const char* name, const ServiceEvent* event) const { | 214 void AddProperty(const char* name, const ServiceEvent* event) const { |
215 stream_->PrintProperty(name, event); | 215 stream_->PrintProperty(name, event); |
216 } | 216 } |
217 void AddProperty(const char* name, Breakpoint* bpt) const { | 217 void AddProperty(const char* name, SourceBreakpoint* bpt) const { |
218 stream_->PrintProperty(name, bpt); | 218 stream_->PrintProperty(name, bpt); |
219 } | 219 } |
220 void AddProperty(const char* name, Metric* metric) const { | 220 void AddProperty(const char* name, Metric* metric) const { |
221 stream_->PrintProperty(name, metric); | 221 stream_->PrintProperty(name, metric); |
222 } | 222 } |
223 void AddProperty(const char* name, MessageQueue* queue) const { | 223 void AddProperty(const char* name, MessageQueue* queue) const { |
224 stream_->PrintProperty(name, queue); | 224 stream_->PrintProperty(name, queue); |
225 } | 225 } |
226 void AddProperty(const char* name, Isolate* isolate) const { | 226 void AddProperty(const char* name, Isolate* isolate) const { |
227 stream_->PrintProperty(name, isolate); | 227 stream_->PrintProperty(name, isolate); |
(...skipping 30 matching lines...) Expand all Loading... |
258 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 258 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
259 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } | 259 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } |
260 void AddValue(double d) const { stream_->PrintValue(d); } | 260 void AddValue(double d) const { stream_->PrintValue(d); } |
261 void AddValue(const char* s) const { stream_->PrintValue(s); } | 261 void AddValue(const char* s) const { stream_->PrintValue(s); } |
262 void AddValue(const Object& obj, bool ref = true) const { | 262 void AddValue(const Object& obj, bool ref = true) const { |
263 stream_->PrintValue(obj, ref); | 263 stream_->PrintValue(obj, ref); |
264 } | 264 } |
265 void AddValue(Isolate* isolate, bool ref = true) const { | 265 void AddValue(Isolate* isolate, bool ref = true) const { |
266 stream_->PrintValue(isolate, ref); | 266 stream_->PrintValue(isolate, ref); |
267 } | 267 } |
268 void AddValue(Breakpoint* bpt) const { | 268 void AddValue(SourceBreakpoint* bpt) const { |
269 stream_->PrintValue(bpt); | 269 stream_->PrintValue(bpt); |
270 } | 270 } |
271 void AddValue(const ServiceEvent* event) const { | 271 void AddValue(const ServiceEvent* event) const { |
272 stream_->PrintValue(event); | 272 stream_->PrintValue(event); |
273 } | 273 } |
274 void AddValue(Metric* metric) const { | 274 void AddValue(Metric* metric) const { |
275 stream_->PrintValue(metric); | 275 stream_->PrintValue(metric); |
276 } | 276 } |
277 void AddValue(MessageQueue* queue) const { | 277 void AddValue(MessageQueue* queue) const { |
278 stream_->PrintValue(queue); | 278 stream_->PrintValue(queue); |
279 } | 279 } |
280 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 280 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
281 | 281 |
282 private: | 282 private: |
283 JSONStream* stream_; | 283 JSONStream* stream_; |
284 | 284 |
285 friend class JSONObject; | 285 friend class JSONObject; |
286 | 286 |
287 DISALLOW_ALLOCATION(); | 287 DISALLOW_ALLOCATION(); |
288 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 288 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
289 }; | 289 }; |
290 | 290 |
291 } // namespace dart | 291 } // namespace dart |
292 | 292 |
293 #endif // VM_JSON_STREAM_H_ | 293 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |