| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 assign(s); | 106 assign(s); |
| 107 return *this; | 107 return *this; |
| 108 } | 108 } |
| 109 | 109 |
| 110 BLINK_COMMON_EXPORT void reset(); | 110 BLINK_COMMON_EXPORT void reset(); |
| 111 BLINK_COMMON_EXPORT void assign(const WebString&); | 111 BLINK_COMMON_EXPORT void assign(const WebString&); |
| 112 BLINK_COMMON_EXPORT void assign(const WebUChar* data, size_t len); | 112 BLINK_COMMON_EXPORT void assign(const WebUChar* data, size_t len); |
| 113 | 113 |
| 114 BLINK_COMMON_EXPORT bool equals(const WebString&) const; | 114 BLINK_COMMON_EXPORT bool equals(const WebString&) const; |
| 115 BLINK_COMMON_EXPORT bool equals(const char* characters, size_t len) const; | 115 BLINK_COMMON_EXPORT bool equals(const char* characters, size_t len) const; |
| 116 bool equals(const char* characters) const { |
| 117 return equals(characters, characters ? strlen(characters) : 0); |
| 118 } |
| 116 | 119 |
| 117 BLINK_COMMON_EXPORT size_t length() const; | 120 BLINK_COMMON_EXPORT size_t length() const; |
| 118 | 121 |
| 119 bool isEmpty() const { return !length(); } | 122 bool isEmpty() const { return !length(); } |
| 120 bool isNull() const { return m_private.isNull(); } | 123 bool isNull() const { return m_private.isNull(); } |
| 121 | 124 |
| 122 BLINK_COMMON_EXPORT std::string utf8( | 125 BLINK_COMMON_EXPORT std::string utf8( |
| 123 UTF8ConversionMode = UTF8ConversionMode::kLenient) const; | 126 UTF8ConversionMode = UTF8ConversionMode::kLenient) const; |
| 124 | 127 |
| 125 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, | 128 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data, |
| 126 size_t length); | 129 size_t length); |
| 127 BLINK_COMMON_EXPORT static WebString fromUTF8(const char* data); | |
| 128 | |
| 129 static WebString fromUTF8(const std::string& s) { | 130 static WebString fromUTF8(const std::string& s) { |
| 130 return fromUTF8(s.data(), s.length()); | 131 return fromUTF8(s.data(), s.length()); |
| 131 } | 132 } |
| 132 | 133 |
| 133 base::string16 utf16() const { | 134 base::string16 utf16() const { |
| 134 return base::Latin1OrUTF16ToUTF16(length(), data8(), data16()); | 135 return base::Latin1OrUTF16ToUTF16(length(), data8(), data16()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 BLINK_COMMON_EXPORT static WebString fromUTF16(const base::string16&); | 138 BLINK_COMMON_EXPORT static WebString fromUTF16(const base::string16&); |
| 138 | 139 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 BLINK_COMMON_EXPORT bool is8Bit() const; | 223 BLINK_COMMON_EXPORT bool is8Bit() const; |
| 223 BLINK_COMMON_EXPORT const WebLChar* data8() const; | 224 BLINK_COMMON_EXPORT const WebLChar* data8() const; |
| 224 BLINK_COMMON_EXPORT const WebUChar* data16() const; | 225 BLINK_COMMON_EXPORT const WebUChar* data16() const; |
| 225 | 226 |
| 226 BLINK_COMMON_EXPORT void assign(WTF::StringImpl*); | 227 BLINK_COMMON_EXPORT void assign(WTF::StringImpl*); |
| 227 | 228 |
| 228 WebPrivatePtr<WTF::StringImpl> m_private; | 229 WebPrivatePtr<WTF::StringImpl> m_private; |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 inline bool operator==(const WebString& a, const char* b) { | 232 inline bool operator==(const WebString& a, const char* b) { |
| 232 return a.equals(b, b ? strlen(b) : 0); | 233 return a.equals(b); |
| 233 } | 234 } |
| 234 | 235 |
| 235 inline bool operator!=(const WebString& a, const char* b) { | 236 inline bool operator!=(const WebString& a, const char* b) { |
| 236 return !(a == b); | 237 return !(a == b); |
| 237 } | 238 } |
| 238 | 239 |
| 239 inline bool operator==(const char* a, const WebString& b) { | 240 inline bool operator==(const char* a, const WebString& b) { |
| 240 return b == a; | 241 return b == a; |
| 241 } | 242 } |
| 242 | 243 |
| 243 inline bool operator!=(const char* a, const WebString& b) { | 244 inline bool operator!=(const char* a, const WebString& b) { |
| 244 return !(b == a); | 245 return !(b == a); |
| 245 } | 246 } |
| 246 | 247 |
| 247 inline bool operator==(const WebString& a, const WebString& b) { | 248 inline bool operator==(const WebString& a, const WebString& b) { |
| 248 return a.equals(b); | 249 return a.equals(b); |
| 249 } | 250 } |
| 250 | 251 |
| 251 inline bool operator!=(const WebString& a, const WebString& b) { | 252 inline bool operator!=(const WebString& a, const WebString& b) { |
| 252 return !(a == b); | 253 return !(a == b); |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace blink | 256 } // namespace blink |
| 256 | 257 |
| 257 #endif | 258 #endif |
| OLD | NEW |