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 patch class StringBuffer { | 5 patch class StringBuffer { |
6 List<String> _buffer; | 6 List<String> _buffer; |
7 int _length; | 7 int _length; |
8 | 8 |
9 /// Creates the string buffer with an initial content. | 9 /// Creates the string buffer with an initial content. |
10 /* patch */ StringBuffer([Object content = ""]) { | 10 /* patch */ StringBuffer([Object content = ""]) { |
(...skipping 25 matching lines...) Expand all Loading... |
36 /// Clears the string buffer. | 36 /// Clears the string buffer. |
37 /* patch */ void clear() { | 37 /* patch */ void clear() { |
38 _buffer = new List<String>(); | 38 _buffer = new List<String>(); |
39 _length = 0; | 39 _length = 0; |
40 } | 40 } |
41 | 41 |
42 /// Returns the contents of buffer as a concatenated string. | 42 /// Returns the contents of buffer as a concatenated string. |
43 /* patch */ String toString() { | 43 /* patch */ String toString() { |
44 if (_buffer.length == 0) return ""; | 44 if (_buffer.length == 0) return ""; |
45 if (_buffer.length == 1) return _buffer[0]; | 45 if (_buffer.length == 1) return _buffer[0]; |
46 String result = Strings.concatAll(_buffer); | 46 String result = _StringBase.concatAll(_buffer); |
47 _buffer.clear(); | 47 _buffer.clear(); |
48 _buffer.add(result); | 48 _buffer.add(result); |
49 // Since we track the length at each add operation, there is no | 49 // Since we track the length at each add operation, there is no |
50 // need to update it in this function. | 50 // need to update it in this function. |
51 return result; | 51 return result; |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |