| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 private: | 129 private: |
| 130 void Clear(); | 130 void Clear(); |
| 131 void PostNullReply(Dart_Port port); | 131 void PostNullReply(Dart_Port port); |
| 132 | 132 |
| 133 void OpenObject(const char* property_name = NULL); | 133 void OpenObject(const char* property_name = NULL); |
| 134 void CloseObject(); | 134 void CloseObject(); |
| 135 | 135 |
| 136 void OpenArray(const char* property_name = NULL); | 136 void OpenArray(const char* property_name = NULL); |
| 137 void CloseArray(); | 137 void CloseArray(); |
| 138 | 138 |
| 139 void PrintValueNull(); |
| 139 void PrintValueBool(bool b); | 140 void PrintValueBool(bool b); |
| 140 void PrintValue(intptr_t i); | 141 void PrintValue(intptr_t i); |
| 141 void PrintValue64(int64_t i); | 142 void PrintValue64(int64_t i); |
| 142 void PrintValueTimeMillis(int64_t millis); | 143 void PrintValueTimeMillis(int64_t millis); |
| 143 void PrintValueTimeMicros(int64_t micros); | 144 void PrintValueTimeMicros(int64_t micros); |
| 144 void PrintValue(double d); | 145 void PrintValue(double d); |
| 145 void PrintValueBase64(const uint8_t* bytes, intptr_t length); | 146 void PrintValueBase64(const uint8_t* bytes, intptr_t length); |
| 146 void PrintValue(const char* s); | 147 void PrintValue(const char* s); |
| 147 void PrintValue(const char* s, intptr_t len); | 148 void PrintValue(const char* s, intptr_t len); |
| 148 void PrintValueNoEscape(const char* s); | 149 void PrintValueNoEscape(const char* s); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 JSONArray(const JSONObject* obj, const char* name) : stream_(obj->stream_) { | 322 JSONArray(const JSONObject* obj, const char* name) : stream_(obj->stream_) { |
| 322 stream_->OpenArray(name); | 323 stream_->OpenArray(name); |
| 323 } | 324 } |
| 324 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { | 325 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { |
| 325 stream_->OpenArray(); | 326 stream_->OpenArray(); |
| 326 } | 327 } |
| 327 ~JSONArray() { | 328 ~JSONArray() { |
| 328 stream_->CloseArray(); | 329 stream_->CloseArray(); |
| 329 } | 330 } |
| 330 | 331 |
| 332 void AddValueNull() const { stream_->PrintValueNull(); } |
| 331 void AddValue(bool b) const { stream_->PrintValueBool(b); } | 333 void AddValue(bool b) const { stream_->PrintValueBool(b); } |
| 332 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 334 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
| 333 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } | 335 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } |
| 334 void AddValueTimeMillis(int64_t millis) const { | 336 void AddValueTimeMillis(int64_t millis) const { |
| 335 stream_->PrintValueTimeMillis(millis); | 337 stream_->PrintValueTimeMillis(millis); |
| 336 } | 338 } |
| 337 void AddValueTimeMicros(int64_t micros) const { | 339 void AddValueTimeMicros(int64_t micros) const { |
| 338 stream_->PrintValueTimeMicros(micros); | 340 stream_->PrintValueTimeMicros(micros); |
| 339 } | 341 } |
| 340 void AddValue(double d) const { stream_->PrintValue(d); } | 342 void AddValue(double d) const { stream_->PrintValue(d); } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 370 | 372 |
| 371 friend class JSONObject; | 373 friend class JSONObject; |
| 372 | 374 |
| 373 DISALLOW_ALLOCATION(); | 375 DISALLOW_ALLOCATION(); |
| 374 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 376 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 375 }; | 377 }; |
| 376 | 378 |
| 377 } // namespace dart | 379 } // namespace dart |
| 378 | 380 |
| 379 #endif // VM_JSON_STREAM_H_ | 381 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |