| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "WebString.h" | 32 #include "WebString.h" |
| 33 | 33 |
| 34 #include "WebCString.h" |
| 35 |
| 36 #include "CString.h" |
| 34 #include "PlatformString.h" | 37 #include "PlatformString.h" |
| 35 #include "AtomicString.h" | 38 #include "AtomicString.h" |
| 36 | 39 |
| 37 namespace WebKit { | 40 namespace WebKit { |
| 38 | 41 |
| 39 class WebStringPrivate : public WebCore::StringImpl { | 42 class WebStringPrivate : public WebCore::StringImpl { |
| 40 }; | 43 }; |
| 41 | 44 |
| 42 void WebString::reset() | 45 void WebString::reset() |
| 43 { | 46 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 61 size_t WebString::length() const | 64 size_t WebString::length() const |
| 62 { | 65 { |
| 63 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; | 66 return m_private ? const_cast<WebStringPrivate*>(m_private)->length() : 0; |
| 64 } | 67 } |
| 65 | 68 |
| 66 const WebUChar* WebString::data() const | 69 const WebUChar* WebString::data() const |
| 67 { | 70 { |
| 68 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() : 0; | 71 return m_private ? const_cast<WebStringPrivate*>(m_private)->characters() : 0; |
| 69 } | 72 } |
| 70 | 73 |
| 74 WebCString WebString::utf8() const |
| 75 { |
| 76 return WebCore::String(m_private).utf8(); |
| 77 } |
| 78 |
| 71 WebString WebString::fromUTF8(const char* data, size_t length) | 79 WebString WebString::fromUTF8(const char* data, size_t length) |
| 72 { | 80 { |
| 73 return WebCore::String::fromUTF8(data, length); | 81 return WebCore::String::fromUTF8(data, length); |
| 74 } | 82 } |
| 75 | 83 |
| 76 WebString WebString::fromUTF8(const char* data) | 84 WebString WebString::fromUTF8(const char* data) |
| 77 { | 85 { |
| 78 return WebCore::String::fromUTF8(data); | 86 return WebCore::String::fromUTF8(data); |
| 79 } | 87 } |
| 80 | 88 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 { | 125 { |
| 118 // Take care to handle the case where m_private == p | 126 // Take care to handle the case where m_private == p |
| 119 if (p) | 127 if (p) |
| 120 p->ref(); | 128 p->ref(); |
| 121 if (m_private) | 129 if (m_private) |
| 122 m_private->deref(); | 130 m_private->deref(); |
| 123 m_private = p; | 131 m_private = p; |
| 124 } | 132 } |
| 125 | 133 |
| 126 } // namespace WebKit | 134 } // namespace WebKit |
| OLD | NEW |