OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 #ifndef RUNTIME_VM_ZONE_TEXT_BUFFER_H_ |
| 6 #define RUNTIME_VM_ZONE_TEXT_BUFFER_H_ |
| 7 |
| 8 #include "vm/allocation.h" |
| 9 #include "vm/globals.h" |
| 10 |
| 11 namespace dart { |
| 12 |
| 13 class Zone; |
| 14 |
| 15 // TextBuffer maintains a dynamic character buffer with a printf-style way to |
| 16 // append text. |
| 17 class ZoneTextBuffer : ValueObject { |
| 18 public: |
| 19 ZoneTextBuffer(Zone* zone, intptr_t initial_capacity); |
| 20 ~ZoneTextBuffer() {} |
| 21 |
| 22 intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 23 void AddString(const char* s); |
| 24 |
| 25 char* buffer() { return buffer_; } |
| 26 intptr_t length() { return length_; } |
| 27 |
| 28 private: |
| 29 void EnsureCapacity(intptr_t len); |
| 30 Zone* zone_; |
| 31 char* buffer_; |
| 32 intptr_t length_; |
| 33 intptr_t capacity_; |
| 34 }; |
| 35 |
| 36 } // namespace dart |
| 37 |
| 38 #endif // RUNTIME_VM_ZONE_TEXT_BUFFER_H_ |
OLD | NEW |