OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 size_t WebString::length() const | 63 size_t WebString::length() const |
64 { | 64 { |
65 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; | 65 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; |
66 } | 66 } |
67 | 67 |
68 const WebUChar* WebString::data() const | 68 const WebUChar* WebString::data() const |
69 { | 69 { |
70 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() :
0; | 70 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() :
0; |
71 } | 71 } |
72 | 72 |
| 73 bool WebString::is8Bit() const |
| 74 { |
| 75 return m_private->is8Bit(); |
| 76 } |
| 77 |
| 78 const WebLChar* WebString::data8() const |
| 79 { |
| 80 ASSERT(is8Bit()); |
| 81 return m_private->characters8(); |
| 82 } |
| 83 |
| 84 const WebUChar* WebString::data16() const |
| 85 { |
| 86 ASSERT(!is8Bit()); |
| 87 return m_private->characters16(); |
| 88 } |
| 89 |
73 WebCString WebString::utf8() const | 90 WebCString WebString::utf8() const |
74 { | 91 { |
75 return WTF::String(m_private).utf8(); | 92 return WTF::String(m_private).utf8(); |
76 } | 93 } |
77 | 94 |
78 WebString WebString::fromUTF8(const char* data, size_t length) | 95 WebString WebString::fromUTF8(const char* data, size_t length) |
79 { | 96 { |
80 return WTF::String::fromUTF8(data, length); | 97 return WTF::String::fromUTF8(data, length); |
81 } | 98 } |
82 | 99 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 { | 146 { |
130 // Take care to handle the case where m_private == p | 147 // Take care to handle the case where m_private == p |
131 if (p) | 148 if (p) |
132 p->ref(); | 149 p->ref(); |
133 if (m_private) | 150 if (m_private) |
134 m_private->deref(); | 151 m_private->deref(); |
135 m_private = p; | 152 m_private = p; |
136 } | 153 } |
137 | 154 |
138 } // namespace WebKit | 155 } // namespace WebKit |
OLD | NEW |