Index: runtime/vm/json_stream.h |
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b019ff569259ee77edf60cccad5b593b3e4d492 |
--- /dev/null |
+++ b/runtime/vm/json_stream.h |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#ifndef VM_JSON_STREAM_H_ |
+#define VM_JSON_STREAM_H_ |
+ |
+#include "platform/json.h" |
+ |
+namespace dart { |
+ |
+ |
+class JSONStream : ValueObject { |
+ public: |
+ explicit JSONStream(TextBuffer* buffer); |
+ ~JSONStream(); |
+ |
+ void Clear(); |
+ |
+ void OpenObject(const char* property_name = NULL); |
+ void CloseObject(); |
+ |
+ void OpenArray(const char* property_name = NULL); |
+ void CloseArray(); |
+ |
+ void PrintValueBool(bool b); |
+ void PrintValue(intptr_t i); |
+ void PrintValue(double d); |
+ void PrintValue(const char* s); |
+ |
+ void PrintPropertyBool(const char* name, bool b); |
+ void PrintProperty(const char* name, intptr_t i); |
+ void PrintProperty(const char* name, double d); |
+ void PrintProperty(const char* name, const char* s); |
+ |
+ private: |
+ void PrintPropertyName(const char* name); |
+ void PrintCommaIfNeeded(); |
+ bool NeedComma(); |
+ intptr_t open_objects_; |
+ TextBuffer* buffer_; |
+}; |
+ |
+} // namespace dart |
+ |
+#endif // VM_JSON_STREAM_H_ |