OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_JSON_STREAM_H_ |
| 6 #define VM_JSON_STREAM_H_ |
| 7 |
| 8 #include "platform/json.h" |
| 9 |
| 10 namespace dart { |
| 11 |
| 12 |
| 13 class JSONStream : ValueObject { |
| 14 public: |
| 15 explicit JSONStream(TextBuffer* buffer); |
| 16 ~JSONStream(); |
| 17 |
| 18 void Clear(); |
| 19 |
| 20 void OpenObject(const char* property_name = NULL); |
| 21 void CloseObject(); |
| 22 |
| 23 void OpenArray(const char* property_name = NULL); |
| 24 void CloseArray(); |
| 25 |
| 26 void PrintValueBool(bool b); |
| 27 void PrintValue(intptr_t i); |
| 28 void PrintValue(double d); |
| 29 void PrintValue(const char* s); |
| 30 |
| 31 void PrintPropertyBool(const char* name, bool b); |
| 32 void PrintProperty(const char* name, intptr_t i); |
| 33 void PrintProperty(const char* name, double d); |
| 34 void PrintProperty(const char* name, const char* s); |
| 35 |
| 36 private: |
| 37 void PrintPropertyName(const char* name); |
| 38 void PrintCommaIfNeeded(); |
| 39 bool NeedComma(); |
| 40 intptr_t open_objects_; |
| 41 TextBuffer* buffer_; |
| 42 }; |
| 43 |
| 44 } // namespace dart |
| 45 |
| 46 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |