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

Unified Diff: sdk/lib/core/string_buffer.dart

Issue 12217115: Revert "Add StringSink and update StringBuffer." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months 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 | « sdk/lib/core/corelib_sources.gypi ('k') | sdk/lib/core/string_sink.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/string_buffer.dart
diff --git a/sdk/lib/core/string_buffer.dart b/sdk/lib/core/string_buffer.dart
index 2de49498aa19b29b68fdef0356aed9e8fba78711..d8b393583952238a7e66027ba20d0b45b86179e4 100644
--- a/sdk/lib/core/string_buffer.dart
+++ b/sdk/lib/core/string_buffer.dart
@@ -9,77 +9,29 @@ part of dart.core;
* efficiently. Only on a call to [toString] are the strings
* concatenated to a single String.
*/
-class StringBuffer implements StringSink {
+abstract class StringBuffer {
/// Creates the string buffer with an initial content.
- external StringBuffer([Object content = ""]);
+ external factory StringBuffer([Object content = ""]);
/// Returns the length of the buffer.
- external int get length;
+ int get length;
- /// Returns whether the buffer is empty.
- bool get isEmpty => length == 0;
+ // Returns whether the buffer is empty.
+ bool get isEmpty;
- /**
- * Converts [obj] to a string and adds it to the buffer.
- *
- * *Deprecated*. Use [write] instead.
- */
- @deprecated
- void add(Object obj) => write(obj);
-
- void write(Object obj) {
- // TODO(srdjan): The following four lines could be replaced by
- // '$obj', but apparently this is too slow on the Dart VM.
- String str = obj.toString();
- if (str is! String) {
- throw new ArgumentError('toString() did not return a string');
- }
- if (str.isEmpty) return;
- _write(str);
- }
-
-
- void print(Object obj) {
- write(obj);
- _write("\n");
- }
-
- /**
- * Adds the string representation of [charCode] to the buffer.
- *
- * *Deprecated* Use [writeCharCode] instead.
- */
- @deprecated
- void addCharCode(int charCode) {
- writeCharCode(charCode);
- }
+ /// Converts [obj] to a string and adds it to the buffer.
+ void add(Object obj);
/// Adds the string representation of [charCode] to the buffer.
- void writeCharCode(int charCode) {
- _write(new String.fromCharCode(charCode));
- }
+ void addCharCode(int charCode);
- /**
- * Adds all items in [objects] to the buffer.
- *
- * *Deprecated*. Use [:objects.forEach(buffer.write):] instead.
- */
- @deprecated
- void addAll(Iterable objects) {
- for (Object obj in objects) write(obj);
- }
+ /// Adds all items in [objects] to the buffer.
+ void addAll(Iterable objects);
- /**
- * Clears the string buffer.
- *
- * *Deprecated*.
- */
- @deprecated
- external void clear();
+ /// Clears the string buffer.
+ void clear();
/// Returns the contents of buffer as a concatenated string.
- external String toString();
-
- external void _write(String str);
+ String toString();
}
« no previous file with comments | « sdk/lib/core/corelib_sources.gypi ('k') | sdk/lib/core/string_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698