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 SourceBreakpoint; | 25 class Breakpoint; |
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(SourceBreakpoint* bpt); | 118 void PrintValue(Breakpoint* 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 Object& o); | 125 void PrintServiceId(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, SourceBreakpoint* bpt); | 138 void PrintProperty(const char* name, Breakpoint* 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 void AddPropertyNoEscape(const char* name, const char* s) const { | 210 void AddPropertyNoEscape(const char* name, const char* s) const { |
211 stream_->PrintPropertyNoEscape(name, s); | 211 stream_->PrintPropertyNoEscape(name, s); |
212 } | 212 } |
213 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 213 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
214 stream_->PrintProperty(name, obj, ref); | 214 stream_->PrintProperty(name, obj, ref); |
215 } | 215 } |
216 void AddProperty(const char* name, const ServiceEvent* event) const { | 216 void AddProperty(const char* name, const ServiceEvent* event) const { |
217 stream_->PrintProperty(name, event); | 217 stream_->PrintProperty(name, event); |
218 } | 218 } |
219 void AddProperty(const char* name, SourceBreakpoint* bpt) const { | 219 void AddProperty(const char* name, Breakpoint* bpt) const { |
220 stream_->PrintProperty(name, bpt); | 220 stream_->PrintProperty(name, bpt); |
221 } | 221 } |
222 void AddProperty(const char* name, Metric* metric) const { | 222 void AddProperty(const char* name, Metric* metric) const { |
223 stream_->PrintProperty(name, metric); | 223 stream_->PrintProperty(name, metric); |
224 } | 224 } |
225 void AddProperty(const char* name, MessageQueue* queue) const { | 225 void AddProperty(const char* name, MessageQueue* queue) const { |
226 stream_->PrintProperty(name, queue); | 226 stream_->PrintProperty(name, queue); |
227 } | 227 } |
228 void AddProperty(const char* name, Isolate* isolate) const { | 228 void AddProperty(const char* name, Isolate* isolate) const { |
229 stream_->PrintProperty(name, isolate); | 229 stream_->PrintProperty(name, isolate); |
(...skipping 30 matching lines...) Expand all Loading... |
260 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 260 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
261 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } | 261 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } |
262 void AddValue(double d) const { stream_->PrintValue(d); } | 262 void AddValue(double d) const { stream_->PrintValue(d); } |
263 void AddValue(const char* s) const { stream_->PrintValue(s); } | 263 void AddValue(const char* s) const { stream_->PrintValue(s); } |
264 void AddValue(const Object& obj, bool ref = true) const { | 264 void AddValue(const Object& obj, bool ref = true) const { |
265 stream_->PrintValue(obj, ref); | 265 stream_->PrintValue(obj, ref); |
266 } | 266 } |
267 void AddValue(Isolate* isolate, bool ref = true) const { | 267 void AddValue(Isolate* isolate, bool ref = true) const { |
268 stream_->PrintValue(isolate, ref); | 268 stream_->PrintValue(isolate, ref); |
269 } | 269 } |
270 void AddValue(SourceBreakpoint* bpt) const { | 270 void AddValue(Breakpoint* bpt) const { |
271 stream_->PrintValue(bpt); | 271 stream_->PrintValue(bpt); |
272 } | 272 } |
273 void AddValue(const ServiceEvent* event) const { | 273 void AddValue(const ServiceEvent* event) const { |
274 stream_->PrintValue(event); | 274 stream_->PrintValue(event); |
275 } | 275 } |
276 void AddValue(Metric* metric) const { | 276 void AddValue(Metric* metric) const { |
277 stream_->PrintValue(metric); | 277 stream_->PrintValue(metric); |
278 } | 278 } |
279 void AddValue(MessageQueue* queue) const { | 279 void AddValue(MessageQueue* queue) const { |
280 stream_->PrintValue(queue); | 280 stream_->PrintValue(queue); |
281 } | 281 } |
282 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 282 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
283 | 283 |
284 private: | 284 private: |
285 JSONStream* stream_; | 285 JSONStream* stream_; |
286 | 286 |
287 friend class JSONObject; | 287 friend class JSONObject; |
288 | 288 |
289 DISALLOW_ALLOCATION(); | 289 DISALLOW_ALLOCATION(); |
290 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 290 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
291 }; | 291 }; |
292 | 292 |
293 } // namespace dart | 293 } // namespace dart |
294 | 294 |
295 #endif // VM_JSON_STREAM_H_ | 295 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |