Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: runtime/platform/text_buffer.h

Issue 1497033003: - Remove the legacy debug protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/platform_sources.gypi ('k') | runtime/platform/text_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/text_buffer.h
diff --git a/runtime/platform/text_buffer.h b/runtime/platform/text_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8f0c2fcc8c233b493ee2f91903b80dc950d8afc
--- /dev/null
+++ b/runtime/platform/text_buffer.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef PLATFORM_TEXT_BUFFER_H_
+#define PLATFORM_TEXT_BUFFER_H_
+
+#include "vm/allocation.h"
+#include "vm/globals.h"
+
+namespace dart {
+
+
+// TextBuffer maintains a dynamic character buffer with a printf-style way to
+// append text.
+class TextBuffer : ValueObject {
+ public:
+ explicit TextBuffer(intptr_t buf_size);
+ ~TextBuffer();
+
+ intptr_t Printf(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
+ void AddChar(char ch);
+ void EscapeAndAddCodeUnit(uint32_t cu);
+ void AddString(const char* s);
+ void AddEscapedString(const char* s);
+
+ void Clear();
+
+ char* buf() { return buf_; }
+ intptr_t length() { return msg_len_; }
+
+ // Steal ownership of the buffer pointer.
+ // NOTE: TextBuffer is empty afterwards.
+ const char* Steal();
+
+ private:
+ void EnsureCapacity(intptr_t len);
+ char* buf_;
+ intptr_t buf_size_;
+ intptr_t msg_len_;
+};
+
+} // namespace dart
+
+#endif // PLATFORM_TEXT_BUFFER_H_
« no previous file with comments | « runtime/platform/platform_sources.gypi ('k') | runtime/platform/text_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698