| 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 "platform/json.h" | 9 #include "platform/json.h" |
| 9 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| 10 | 11 |
| 11 namespace dart { | 12 namespace dart { |
| 12 | 13 |
| 13 class Field; | 14 class Field; |
| 14 class Instance; | 15 class Instance; |
| 15 class JSONArray; | 16 class JSONArray; |
| 16 class JSONObject; | 17 class JSONObject; |
| 17 class Object; | 18 class Object; |
| 18 class SourceBreakpoint; | 19 class SourceBreakpoint; |
| 19 | 20 |
| 20 class JSONStream : ValueObject { | 21 class JSONStream : ValueObject { |
| 21 public: | 22 public: |
| 22 explicit JSONStream(intptr_t buf_size = 256); | 23 explicit JSONStream(intptr_t buf_size = 256); |
| 23 ~JSONStream(); | 24 ~JSONStream(); |
| 24 | 25 |
| 25 TextBuffer* buffer() { return &buffer_; } | 26 TextBuffer* buffer() { return &buffer_; } |
| 26 const char* ToCString() { return buffer_.buf(); } | 27 const char* ToCString() { return buffer_.buf(); } |
| 27 | 28 |
| 29 void set_reply_port(Dart_Port port); |
| 28 void SetArguments(const char** arguments, intptr_t num_arguments); | 30 void SetArguments(const char** arguments, intptr_t num_arguments); |
| 29 void SetOptions(const char** option_keys, const char** option_values, | 31 void SetOptions(const char** option_keys, const char** option_values, |
| 30 intptr_t num_options); | 32 intptr_t num_options); |
| 31 | 33 |
| 34 Dart_Port reply_port() const { return reply_port_; } |
| 35 |
| 32 intptr_t num_arguments() const { return num_arguments_; } | 36 intptr_t num_arguments() const { return num_arguments_; } |
| 33 const char* GetArgument(intptr_t i) const { | 37 const char* GetArgument(intptr_t i) const { |
| 34 return arguments_[i]; | 38 return arguments_[i]; |
| 35 } | 39 } |
| 36 intptr_t num_options() const { return num_options_; } | 40 intptr_t num_options() const { return num_options_; } |
| 37 const char* GetOptionKey(intptr_t i) const { | 41 const char* GetOptionKey(intptr_t i) const { |
| 38 return option_keys_[i]; | 42 return option_keys_[i]; |
| 39 } | 43 } |
| 40 const char* GetOptionValue(intptr_t i) const { | 44 const char* GetOptionValue(intptr_t i) const { |
| 41 return option_values_[i]; | 45 return option_values_[i]; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 70 void PrintProperty(const char* name, const Object& o, bool ref = true); | 74 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 71 | 75 |
| 72 void PrintPropertyName(const char* name); | 76 void PrintPropertyName(const char* name); |
| 73 void PrintCommaIfNeeded(); | 77 void PrintCommaIfNeeded(); |
| 74 bool NeedComma(); | 78 bool NeedComma(); |
| 75 | 79 |
| 76 intptr_t nesting_level() const { return open_objects_; } | 80 intptr_t nesting_level() const { return open_objects_; } |
| 77 | 81 |
| 78 intptr_t open_objects_; | 82 intptr_t open_objects_; |
| 79 TextBuffer buffer_; | 83 TextBuffer buffer_; |
| 84 Dart_Port reply_port_; |
| 80 const char** arguments_; | 85 const char** arguments_; |
| 81 intptr_t num_arguments_; | 86 intptr_t num_arguments_; |
| 82 const char** option_keys_; | 87 const char** option_keys_; |
| 83 const char** option_values_; | 88 const char** option_values_; |
| 84 intptr_t num_options_; | 89 intptr_t num_options_; |
| 85 | 90 |
| 86 friend class JSONObject; | 91 friend class JSONObject; |
| 87 friend class JSONArray; | 92 friend class JSONArray; |
| 88 }; | 93 }; |
| 89 | 94 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 173 |
| 169 friend class JSONObject; | 174 friend class JSONObject; |
| 170 | 175 |
| 171 DISALLOW_ALLOCATION(); | 176 DISALLOW_ALLOCATION(); |
| 172 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 177 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 173 }; | 178 }; |
| 174 | 179 |
| 175 } // namespace dart | 180 } // namespace dart |
| 176 | 181 |
| 177 #endif // VM_JSON_STREAM_H_ | 182 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |