| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
reserved. |
| 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 using namespace std; | 39 using namespace std; |
| 40 | 40 |
| 41 namespace WTF { | 41 namespace WTF { |
| 42 | 42 |
| 43 using namespace Unicode; | 43 using namespace Unicode; |
| 44 using namespace std; | 44 using namespace std; |
| 45 | 45 |
| 46 // Construct a string with UTF-16 data. | 46 // Construct a string with UTF-16 data. |
| 47 String::String(const UChar* characters, unsigned length) | 47 String::String(const UChar* characters, unsigned length) |
| 48 : m_impl(characters ? StringImpl::create(characters, length) : 0) | 48 : m_impl(characters ? StringImpl::create(characters, length) : nullptr) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Construct a string with UTF-16 data, from a null-terminated source. | 52 // Construct a string with UTF-16 data, from a null-terminated source. |
| 53 String::String(const UChar* str) | 53 String::String(const UChar* str) |
| 54 { | 54 { |
| 55 if (!str) | 55 if (!str) |
| 56 return; | 56 return; |
| 57 m_impl = StringImpl::create(str, lengthOfNullTerminatedString(str)); | 57 m_impl = StringImpl::create(str, lengthOfNullTerminatedString(str)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Construct a string with latin1 data. | 60 // Construct a string with latin1 data. |
| 61 String::String(const LChar* characters, unsigned length) | 61 String::String(const LChar* characters, unsigned length) |
| 62 : m_impl(characters ? StringImpl::create(characters, length) : 0) | 62 : m_impl(characters ? StringImpl::create(characters, length) : nullptr) |
| 63 { | 63 { |
| 64 } | 64 } |
| 65 | 65 |
| 66 String::String(const char* characters, unsigned length) | 66 String::String(const char* characters, unsigned length) |
| 67 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char
acters), length) : 0) | 67 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char
acters), length) : nullptr) |
| 68 { | 68 { |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Construct a string with latin1 data, from a null-terminated source. | 71 // Construct a string with latin1 data, from a null-terminated source. |
| 72 String::String(const LChar* characters) | 72 String::String(const LChar* characters) |
| 73 : m_impl(characters ? StringImpl::create(characters) : 0) | 73 : m_impl(characters ? StringImpl::create(characters) : nullptr) |
| 74 { | 74 { |
| 75 } | 75 } |
| 76 | 76 |
| 77 String::String(const char* characters) | 77 String::String(const char* characters) |
| 78 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char
acters)) : 0) | 78 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char
acters)) : nullptr) |
| 79 { | 79 { |
| 80 } | 80 } |
| 81 | 81 |
| 82 void String::append(const String& string) | 82 void String::append(const String& string) |
| 83 { | 83 { |
| 84 if (string.isEmpty()) | 84 if (string.isEmpty()) |
| 85 return; | 85 return; |
| 86 if (!m_impl) { | 86 if (!m_impl) { |
| 87 m_impl = string.m_impl; | 87 m_impl = string.m_impl; |
| 88 return; | 88 return; |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 buffer.append('\0'); | 1266 buffer.append('\0'); |
| 1267 return buffer; | 1267 return buffer; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 Vector<char> asciiDebug(String& string) | 1270 Vector<char> asciiDebug(String& string) |
| 1271 { | 1271 { |
| 1272 return asciiDebug(string.impl()); | 1272 return asciiDebug(string.impl()); |
| 1273 } | 1273 } |
| 1274 | 1274 |
| 1275 #endif | 1275 #endif |
| OLD | NEW |