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 PLATFORM_JSON_H_ | 5 #ifndef PLATFORM_JSON_H_ |
6 #define PLATFORM_JSON_H_ | 6 #define PLATFORM_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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // with a valid JSON object. Returns NULL otherwise. | 81 // with a valid JSON object. Returns NULL otherwise. |
82 const char* EndOfObject(); | 82 const char* EndOfObject(); |
83 | 83 |
84 JSONType Type() const; | 84 JSONType Type() const; |
85 const char* ValueChars() const { | 85 const char* ValueChars() const { |
86 return (Type() != kNone) ? scanner_.TokenChars() : NULL; | 86 return (Type() != kNone) ? scanner_.TokenChars() : NULL; |
87 } | 87 } |
88 int ValueLen() const { | 88 int ValueLen() const { |
89 return (Type() != kNone) ? scanner_.TokenLen() : 0; | 89 return (Type() != kNone) ? scanner_.TokenLen() : 0; |
90 } | 90 } |
91 void GetValueChars(char* buf, intptr_t buflen) const; | 91 void GetRawValueChars(char* buf, intptr_t buflen) const; |
| 92 void GetDecodedValueChars(char* buf, intptr_t buflen) const; |
92 bool IsStringLiteral(const char* literal) const { | 93 bool IsStringLiteral(const char* literal) const { |
93 return scanner_.IsStringLiteral(literal); | 94 return scanner_.IsStringLiteral(literal); |
94 } | 95 } |
95 bool IsTrue() const { | 96 bool IsTrue() const { |
96 return scanner_.CurrentToken() == JSONScanner::TokenTrue; | 97 return scanner_.CurrentToken() == JSONScanner::TokenTrue; |
97 } | 98 } |
98 bool IsFalse() const { | 99 bool IsFalse() const { |
99 return scanner_.CurrentToken() == JSONScanner::TokenFalse; | 100 return scanner_.CurrentToken() == JSONScanner::TokenFalse; |
100 } | 101 } |
101 bool IsNull() const { | 102 bool IsNull() const { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 private: | 139 private: |
139 void EnsureCapacity(intptr_t len); | 140 void EnsureCapacity(intptr_t len); |
140 char* buf_; | 141 char* buf_; |
141 intptr_t buf_size_; | 142 intptr_t buf_size_; |
142 intptr_t msg_len_; | 143 intptr_t msg_len_; |
143 }; | 144 }; |
144 | 145 |
145 } // namespace dart | 146 } // namespace dart |
146 | 147 |
147 #endif // PLATFORM_JSON_H_ | 148 #endif // PLATFORM_JSON_H_ |
OLD | NEW |