OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (!m_length) | 253 if (!m_length) |
254 return 0; | 254 return 0; |
255 if (!m_string.isNull()) | 255 if (!m_string.isNull()) |
256 return m_string.characters16(); | 256 return m_string.characters16(); |
257 ASSERT(m_buffer); | 257 ASSERT(m_buffer); |
258 return m_buffer->characters16(); | 258 return m_buffer->characters16(); |
259 } | 259 } |
260 | 260 |
261 bool is8Bit() const { return m_is8Bit; } | 261 bool is8Bit() const { return m_is8Bit; } |
262 | 262 |
| 263 unsigned sizeInBytes() const { return length() * (is8Bit() ? sizeof(LChar) :
sizeof(UChar)); } |
| 264 |
263 void clear() | 265 void clear() |
264 { | 266 { |
265 m_length = 0; | 267 m_length = 0; |
266 m_string = String(); | 268 m_string = String(); |
267 m_buffer = 0; | 269 m_buffer = 0; |
268 m_bufferCharacters8 = 0; | 270 m_bufferCharacters8 = 0; |
269 m_is8Bit = true; | 271 m_is8Bit = true; |
270 } | 272 } |
271 | 273 |
272 void swap(StringBuilder& stringBuilder) | 274 void swap(StringBuilder& stringBuilder) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 inline bool operator==(const StringBuilder& a, const String& b) { return equal(a
, b); } | 393 inline bool operator==(const StringBuilder& a, const String& b) { return equal(a
, b); } |
392 inline bool operator!=(const StringBuilder& a, const String& b) { return !equal(
a, b); } | 394 inline bool operator!=(const StringBuilder& a, const String& b) { return !equal(
a, b); } |
393 inline bool operator==(const String& a, const StringBuilder& b) { return equal(b
, a); } | 395 inline bool operator==(const String& a, const StringBuilder& b) { return equal(b
, a); } |
394 inline bool operator!=(const String& a, const StringBuilder& b) { return !equal(
b, a); } | 396 inline bool operator!=(const String& a, const StringBuilder& b) { return !equal(
b, a); } |
395 | 397 |
396 } // namespace WTF | 398 } // namespace WTF |
397 | 399 |
398 using WTF::StringBuilder; | 400 using WTF::StringBuilder; |
399 | 401 |
400 #endif // StringBuilder_h | 402 #endif // StringBuilder_h |
OLD | NEW |