| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_H_ | 5 #ifndef VM_JSON_H_ |
| 6 #define VM_JSON_H_ | 6 #define VM_JSON_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 JSONType Type() const; | 80 JSONType Type() const; |
| 81 const char* ValueChars() const { | 81 const char* ValueChars() const { |
| 82 return (Type() != kNone) ? scanner_.TokenChars() : NULL; | 82 return (Type() != kNone) ? scanner_.TokenChars() : NULL; |
| 83 } | 83 } |
| 84 int ValueLen() const { | 84 int ValueLen() const { |
| 85 return (Type() != kNone) ? scanner_.TokenLen() : 0; | 85 return (Type() != kNone) ? scanner_.TokenLen() : 0; |
| 86 } | 86 } |
| 87 bool IsStringLiteral(const char* literal) const { | 87 bool IsStringLiteral(const char* literal) const { |
| 88 return scanner_.IsStringLiteral(literal); | 88 return scanner_.IsStringLiteral(literal); |
| 89 } | 89 } |
| 90 bool IsTrue() const { |
| 91 return scanner_.CurrentToken() == JSONScanner::TokenTrue; |
| 92 } |
| 93 bool IsFalse() const { |
| 94 return scanner_.CurrentToken() == JSONScanner::TokenFalse; |
| 95 } |
| 96 bool IsNull() const { |
| 97 return scanner_.CurrentToken() == JSONScanner::TokenNull; |
| 98 } |
| 90 | 99 |
| 91 private: | 100 private: |
| 92 JSONScanner scanner_; | 101 JSONScanner scanner_; |
| 93 const char* json_object_; | 102 const char* json_object_; |
| 94 bool error_; | 103 bool error_; |
| 95 }; | 104 }; |
| 96 | 105 |
| 97 | 106 |
| 98 // TextBuffer maintains a dynamic character buffer with a printf-style way to | 107 // TextBuffer maintains a dynamic character buffer with a printf-style way to |
| 99 // append text. | 108 // append text. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 private: | 119 private: |
| 111 void GrowBuffer(intptr_t len); | 120 void GrowBuffer(intptr_t len); |
| 112 char* buf_; | 121 char* buf_; |
| 113 intptr_t buf_size_; | 122 intptr_t buf_size_; |
| 114 intptr_t msg_len_; | 123 intptr_t msg_len_; |
| 115 }; | 124 }; |
| 116 | 125 |
| 117 } // namespace dart | 126 } // namespace dart |
| 118 | 127 |
| 119 #endif // VM_JSON_H_ | 128 #endif // VM_JSON_H_ |
| OLD | NEW |