| 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 16 matching lines...) Expand all Loading... |
| 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 #ifndef WebString_h | 31 #ifndef WebString_h |
| 32 #define WebString_h | 32 #define WebString_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebPrivatePtr.h" | 35 #include "WebPrivatePtr.h" |
| 36 | 36 |
| 37 #if WEBKIT_IMPLEMENTATION | 37 #if INSIDE_WEBKIT |
| 38 #include <wtf/Forward.h> | 38 #include <wtf/Forward.h> |
| 39 #else | 39 #else |
| 40 #include <base/strings/latin1_string_conversions.h> | 40 #include <base/strings/latin1_string_conversions.h> |
| 41 #include <base/strings/nullable_string16.h> | 41 #include <base/strings/nullable_string16.h> |
| 42 #include <base/strings/string16.h> | 42 #include <base/strings/string16.h> |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace WTF { | 45 namespace WTF { |
| 46 class StringImpl; | 46 class StringImpl; |
| 47 } | 47 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 WebString(const WebString& s) { assign(s); } | 69 WebString(const WebString& s) { assign(s); } |
| 70 | 70 |
| 71 WebString& operator=(const WebString& s) | 71 WebString& operator=(const WebString& s) |
| 72 { | 72 { |
| 73 assign(s); | 73 assign(s); |
| 74 return *this; | 74 return *this; |
| 75 } | 75 } |
| 76 | 76 |
| 77 WEBKIT_EXPORT void reset(); | 77 BLINK_COMMON_EXPORT void reset(); |
| 78 WEBKIT_EXPORT void assign(const WebString&); | 78 BLINK_COMMON_EXPORT void assign(const WebString&); |
| 79 WEBKIT_EXPORT void assign(const WebUChar* data, size_t len); | 79 BLINK_COMMON_EXPORT void assign(const WebUChar* data, size_t len); |
| 80 | 80 |
| 81 WEBKIT_EXPORT bool equals(const WebString& s) const; | 81 BLINK_COMMON_EXPORT bool equals(const WebString&) const; |
| 82 | 82 |
| 83 WEBKIT_EXPORT size_t length() const; | 83 BLINK_COMMON_EXPORT size_t length() const; |
| 84 | 84 |
| 85 // Caller must check bounds. | 85 // Caller must check bounds. |
| 86 WEBKIT_EXPORT WebUChar at(unsigned) const; | 86 BLINK_COMMON_EXPORT WebUChar at(unsigned) const; |
| 87 | 87 |
| 88 bool isEmpty() const { return !length(); } | 88 bool isEmpty() const { return !length(); } |
| 89 bool isNull() const { return m_private.isNull(); } | 89 bool isNull() const { return m_private.isNull(); } |
| 90 | 90 |
| 91 WEBKIT_EXPORT WebCString utf8() const; | 91 BLINK_COMMON_EXPORT WebCString utf8() const; |
| 92 | 92 |
| 93 WEBKIT_EXPORT static WebString fromUTF8(const char* data, size_t length); | 93 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, size_t lengt
h); |
| 94 WEBKIT_EXPORT static WebString fromUTF8(const char* data); | 94 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data); |
| 95 | 95 |
| 96 template <int N> WebString(const char (&data)[N]) | 96 template <int N> WebString(const char (&data)[N]) |
| 97 { | 97 { |
| 98 assign(fromUTF8(data, N - 1)); | 98 assign(fromUTF8(data, N - 1)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 template <int N> WebString& operator=(const char (&data)[N]) | 101 template <int N> WebString& operator=(const char (&data)[N]) |
| 102 { | 102 { |
| 103 assign(fromUTF8(data, N - 1)); | 103 assign(fromUTF8(data, N - 1)); |
| 104 return *this; | 104 return *this; |
| 105 } | 105 } |
| 106 | 106 |
| 107 #if WEBKIT_IMPLEMENTATION | 107 #if INSIDE_WEBKIT |
| 108 WebString(const WTF::String&); | 108 BLINK_COMMON_EXPORT WebString(const WTF::String&); |
| 109 WebString& operator=(const WTF::String&); | 109 BLINK_COMMON_EXPORT WebString& operator=(const WTF::String&); |
| 110 operator WTF::String() const; | 110 BLINK_COMMON_EXPORT operator WTF::String() const; |
| 111 | 111 |
| 112 WebString(const WTF::AtomicString&); | 112 BLINK_COMMON_EXPORT WebString(const WTF::AtomicString&); |
| 113 WebString& operator=(const WTF::AtomicString&); | 113 BLINK_COMMON_EXPORT WebString& operator=(const WTF::AtomicString&); |
| 114 operator WTF::AtomicString() const; | 114 BLINK_COMMON_EXPORT operator WTF::AtomicString() const; |
| 115 #else | 115 #else |
| 116 | 116 |
| 117 WebString(const base::string16& s) | 117 WebString(const base::string16& s) |
| 118 { | 118 { |
| 119 assign(s.data(), s.length()); | 119 assign(s.data(), s.length()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 WebString& operator=(const base::string16& s) | 122 WebString& operator=(const base::string16& s) |
| 123 { | 123 { |
| 124 assign(s.data(), s.length()); | 124 assign(s.data(), s.length()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 153 } | 153 } |
| 154 | 154 |
| 155 template <class UTF8String> | 155 template <class UTF8String> |
| 156 static WebString fromUTF8(const UTF8String& s) | 156 static WebString fromUTF8(const UTF8String& s) |
| 157 { | 157 { |
| 158 return fromUTF8(s.data(), s.length()); | 158 return fromUTF8(s.data(), s.length()); |
| 159 } | 159 } |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 WEBKIT_EXPORT bool is8Bit() const; | 163 BLINK_COMMON_EXPORT bool is8Bit() const; |
| 164 WEBKIT_EXPORT const WebLChar* data8() const; | 164 BLINK_COMMON_EXPORT const WebLChar* data8() const; |
| 165 WEBKIT_EXPORT const WebUChar* data16() const; | 165 BLINK_COMMON_EXPORT const WebUChar* data16() const; |
| 166 | 166 |
| 167 void assign(WTF::StringImpl*); | 167 BLINK_COMMON_EXPORT void assign(WTF::StringImpl*); |
| 168 | 168 |
| 169 WebPrivatePtr<WTF::StringImpl> m_private; | 169 WebPrivatePtr<WTF::StringImpl> m_private; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 inline bool operator==(const WebString& a, const WebString& b) | 172 inline bool operator==(const WebString& a, const WebString& b) |
| 173 { | 173 { |
| 174 return a.equals(b); | 174 return a.equals(b); |
| 175 } | 175 } |
| 176 | 176 |
| 177 inline bool operator!=(const WebString& a, const WebString& b) | 177 inline bool operator!=(const WebString& a, const WebString& b) |
| 178 { | 178 { |
| 179 return !(a == b); | 179 return !(a == b); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace WebKit | 182 } // namespace WebKit |
| 183 | 183 |
| 184 #endif | 184 #endif |
| OLD | NEW |