Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1844)

Unified Diff: runtime/vm/json_stream.h

Issue 18168003: JSONStream and tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/json_stream.cc » ('j') | runtime/vm/json_stream.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ae745c621e3642a50236b266c65e36c29b2e7658
--- /dev/null
+++ b/runtime/vm/json_stream.h
@@ -0,0 +1,47 @@
+// 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();
Ivan Posva 2013/07/01 23:18:14 When do you expect to ever have to call Clear() on
Cutch 2013/07/01 23:33:55 Possibly never. I can remove this.
+
+ void OpenObject();
+ void CloseObject();
+
+ void OpenArray();
+ void CloseArray();
+
+ void PrintValueBool(bool b);
+ void PrintValue(int i);
+ void PrintValue(double d);
+ void PrintValue(const char* s);
+
+ void PrintPropertyBool(const char* name, bool b);
+ void PrintProperty(const char* name, int i);
+ void PrintProperty(const char* name, double d);
+ void PrintProperty(const char* name, const char* s);
+
+ void PrintPropertyName(const char* name);
Ivan Posva 2013/07/01 23:18:14 Shouldn't this be a private?
Cutch 2013/07/01 23:33:55 Not without a change to OpenObject. This is neede
+
+ private:
+ void PrintCommaIfNeeded();
+ bool NeedComma();
+ intptr_t open_objects_;
+ TextBuffer* buffer_;
+};
+
+} // namespace dart
+
+#endif // VM_JSON_STREAM_H_
« no previous file with comments | « no previous file | runtime/vm/json_stream.cc » ('j') | runtime/vm/json_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698