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 RUNTIME_PLATFORM_TEXT_BUFFER_H_ | 5 #ifndef RUNTIME_PLATFORM_TEXT_BUFFER_H_ |
6 #define RUNTIME_PLATFORM_TEXT_BUFFER_H_ | 6 #define RUNTIME_PLATFORM_TEXT_BUFFER_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 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 | |
14 // TextBuffer maintains a dynamic character buffer with a printf-style way to | 13 // TextBuffer maintains a dynamic character buffer with a printf-style way to |
15 // append text. | 14 // append text. |
16 class TextBuffer : ValueObject { | 15 class TextBuffer : ValueObject { |
17 public: | 16 public: |
18 explicit TextBuffer(intptr_t buf_size); | 17 explicit TextBuffer(intptr_t buf_size); |
19 ~TextBuffer(); | 18 ~TextBuffer(); |
20 | 19 |
21 intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 20 intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
22 void AddChar(char ch); | 21 void AddChar(char ch); |
23 void EscapeAndAddUTF16CodeUnit(uint16_t cu); | 22 void EscapeAndAddUTF16CodeUnit(uint16_t cu); |
(...skipping 14 matching lines...) Expand all Loading... |
38 private: | 37 private: |
39 void EnsureCapacity(intptr_t len); | 38 void EnsureCapacity(intptr_t len); |
40 char* buf_; | 39 char* buf_; |
41 intptr_t buf_size_; | 40 intptr_t buf_size_; |
42 intptr_t msg_len_; | 41 intptr_t msg_len_; |
43 }; | 42 }; |
44 | 43 |
45 } // namespace dart | 44 } // namespace dart |
46 | 45 |
47 #endif // RUNTIME_PLATFORM_TEXT_BUFFER_H_ | 46 #endif // RUNTIME_PLATFORM_TEXT_BUFFER_H_ |
OLD | NEW |