Changeset 87269 in webkit
- Timestamp:
- May 24, 2011 9:38:26 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r87243 r87269 1 2011-05-24 Kevin Ollivier <kevino@theolliviers.com> 2 3 Reviewed by Eric Seidel. 4 5 Add export macros to WTFString.h. 6 7 https://bugs.webkit.org/show_bug.cgi?id=27551 8 9 * wtf/text/WTFString.h: 10 (WTF::String::String): 11 (WTF::String::findIgnoringCase): 12 (WTF::String::isHashTableDeletedValue): 13 1 14 2011-05-24 Geoffrey Garen <ggaren@apple.com> 2 15 -
trunk/Source/JavaScriptCore/wtf/text/WTFString.h
r86330 r87269 68 68 bool charactersAreAllASCII(const UChar*, size_t); 69 69 bool charactersAreAllLatin1(const UChar*, size_t); 70 int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);71 unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);70 WTF_EXPORT_PRIVATE int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10); 71 WTF_EXPORT_PRIVATE unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10); 72 72 int64_t charactersToInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10); 73 73 uint64_t charactersToUInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10); … … 80 80 intptr_t charactersToIntPtr(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage 81 81 82 double charactersToDouble(const UChar*, size_t, bool* ok = 0, bool* didReadNumber = 0);82 WTF_EXPORT_PRIVATE double charactersToDouble(const UChar*, size_t, bool* ok = 0, bool* didReadNumber = 0); 83 83 float charactersToFloat(const UChar*, size_t, bool* ok = 0, bool* didReadNumber = 0); 84 84 … … 88 88 public: 89 89 // Construct a null string, distinguishable from an empty string. 90 String() { }90 WTF_EXPORT_PRIVATE String() { } 91 91 92 92 // Construct a string with UTF-16 data. 93 String(const UChar* characters, unsigned length);93 WTF_EXPORT_PRIVATE String(const UChar* characters, unsigned length); 94 94 95 95 // Construct a string by copying the contents of a vector. To avoid … … 99 99 100 100 // Construct a string with UTF-16 data, from a null-terminated source. 101 String(const UChar*);101 WTF_EXPORT_PRIVATE String(const UChar*); 102 102 103 103 // Construct a string with latin1 data. 104 String(const char* characters, unsigned length);104 WTF_EXPORT_PRIVATE String(const char* characters, unsigned length); 105 105 106 106 // Construct a string with latin1 data, from a null-terminated source. 107 String(const char* characters);107 WTF_EXPORT_PRIVATE String(const char* characters); 108 108 109 109 // Construct a string referencing an existing StringImpl. 110 String(StringImpl* impl) : m_impl(impl) { }111 String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }112 String(RefPtr<StringImpl> impl) : m_impl(impl) { }110 WTF_EXPORT_PRIVATE String(StringImpl* impl) : m_impl(impl) { } 111 WTF_EXPORT_PRIVATE String(PassRefPtr<StringImpl> impl) : m_impl(impl) { } 112 WTF_EXPORT_PRIVATE String(RefPtr<StringImpl> impl) : m_impl(impl) { } 113 113 114 114 // Inline the destructor. … … 140 140 } 141 141 142 CString ascii() const;143 CString latin1() const;144 CString utf8(bool strict = false) const;142 WTF_EXPORT_PRIVATE CString ascii() const; 143 WTF_EXPORT_PRIVATE CString latin1() const; 144 WTF_EXPORT_PRIVATE CString utf8(bool strict = false) const; 145 145 146 146 UChar operator[](unsigned index) const … … 151 151 } 152 152 153 static String number(short);154 static String number(unsigned short);155 static String number(int);156 static String number(unsigned);157 static String number(long);158 static String number(unsigned long);159 static String number(long long);160 static String number(unsigned long long);161 static String number(double);153 WTF_EXPORT_PRIVATE static String number(short); 154 WTF_EXPORT_PRIVATE static String number(unsigned short); 155 WTF_EXPORT_PRIVATE static String number(int); 156 WTF_EXPORT_PRIVATE static String number(unsigned); 157 WTF_EXPORT_PRIVATE static String number(long); 158 WTF_EXPORT_PRIVATE static String number(unsigned long); 159 WTF_EXPORT_PRIVATE static String number(long long); 160 WTF_EXPORT_PRIVATE static String number(unsigned long long); 161 WTF_EXPORT_PRIVATE static String number(double); 162 162 163 163 // Find a single character or string, also with match function & latin1 forms. … … 178 178 179 179 // Case insensitive string matching. 180 size_t findIgnoringCase(const char* str, unsigned start = 0) const180 WTF_EXPORT_PRIVATE size_t findIgnoringCase(const char* str, unsigned start = 0) const 181 181 { return m_impl ? m_impl->findIgnoringCase(str, start) : notFound; } 182 size_t findIgnoringCase(const String& str, unsigned start = 0) const182 WTF_EXPORT_PRIVATE size_t findIgnoringCase(const String& str, unsigned start = 0) const 183 183 { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : notFound; } 184 184 size_t reverseFindIgnoringCase(const String& str, unsigned start = UINT_MAX) const … … 193 193 { return caseSensitive ? reverseFind(str, start) : reverseFindIgnoringCase(str, start); } 194 194 195 const UChar* charactersWithNullTermination();195 WTF_EXPORT_PRIVATE const UChar* charactersWithNullTermination(); 196 196 197 UChar32 characterStartingAt(unsigned) const; // Ditto.197 WTF_EXPORT_PRIVATE UChar32 characterStartingAt(unsigned) const; // Ditto. 198 198 199 199 bool contains(UChar c) const { return find(c) != notFound; } … … 206 206 { return m_impl ? m_impl->endsWith(s.impl(), caseSensitive) : s.isEmpty(); } 207 207 208 void append(const String&);209 void append(char);210 void append(UChar);211 void append(const UChar*, unsigned length);212 void insert(const String&, unsigned pos);208 WTF_EXPORT_PRIVATE void append(const String&); 209 WTF_EXPORT_PRIVATE void append(char); 210 WTF_EXPORT_PRIVATE void append(UChar); 211 WTF_EXPORT_PRIVATE void append(const UChar*, unsigned length); 212 WTF_EXPORT_PRIVATE void insert(const String&, unsigned pos); 213 213 void insert(const UChar*, unsigned length, unsigned pos); 214 214 … … 222 222 void makeSecure(UChar aChar) { if (m_impl) m_impl = m_impl->secure(aChar); } 223 223 224 void truncate(unsigned len);225 void remove(unsigned pos, int len = 1);226 227 String substring(unsigned pos, unsigned len = UINT_MAX) const;224 WTF_EXPORT_PRIVATE void truncate(unsigned len); 225 WTF_EXPORT_PRIVATE void remove(unsigned pos, int len = 1); 226 227 WTF_EXPORT_PRIVATE String substring(unsigned pos, unsigned len = UINT_MAX) const; 228 228 String substringSharingImpl(unsigned pos, unsigned len = UINT_MAX) const; 229 229 String left(unsigned len) const { return substring(0, len); } … … 231 231 232 232 // Returns a lowercase/uppercase version of the string 233 String lower() const;234 String upper() const;235 236 String stripWhiteSpace() const;237 String simplifyWhiteSpace() const;238 239 String removeCharacters(CharacterMatchFunctionPtr) const;233 WTF_EXPORT_PRIVATE String lower() const; 234 WTF_EXPORT_PRIVATE String upper() const; 235 236 WTF_EXPORT_PRIVATE String stripWhiteSpace() const; 237 WTF_EXPORT_PRIVATE String simplifyWhiteSpace() const; 238 239 WTF_EXPORT_PRIVATE String removeCharacters(CharacterMatchFunctionPtr) const; 240 240 template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const; 241 241 242 242 // Return the string with case folded for case insensitive comparison. 243 String foldCase() const;243 WTF_EXPORT_PRIVATE String foldCase() const; 244 244 245 245 #if !PLATFORM(QT) 246 static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);246 WTF_EXPORT_PRIVATE static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2); 247 247 #else 248 static String format(const char *, ...);248 WTF_EXPORT_PRIVATE static String format(const char *, ...); 249 249 #endif 250 250 … … 254 254 static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); } 255 255 256 void split(const String& separator, Vector<String>& result) const;257 void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;258 void split(UChar separator, Vector<String>& result) const;259 void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;260 261 int toIntStrict(bool* ok = 0, int base = 10) const;262 unsigned toUIntStrict(bool* ok = 0, int base = 10) const;263 int64_t toInt64Strict(bool* ok = 0, int base = 10) const;264 uint64_t toUInt64Strict(bool* ok = 0, int base = 10) const;265 intptr_t toIntPtrStrict(bool* ok = 0, int base = 10) const;266 267 int toInt(bool* ok = 0) const;268 unsigned toUInt(bool* ok = 0) const;256 WTF_EXPORT_PRIVATE void split(const String& separator, Vector<String>& result) const; 257 WTF_EXPORT_PRIVATE void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const; 258 WTF_EXPORT_PRIVATE void split(UChar separator, Vector<String>& result) const; 259 WTF_EXPORT_PRIVATE void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const; 260 261 WTF_EXPORT_PRIVATE int toIntStrict(bool* ok = 0, int base = 10) const; 262 WTF_EXPORT_PRIVATE unsigned toUIntStrict(bool* ok = 0, int base = 10) const; 263 WTF_EXPORT_PRIVATE int64_t toInt64Strict(bool* ok = 0, int base = 10) const; 264 WTF_EXPORT_PRIVATE uint64_t toUInt64Strict(bool* ok = 0, int base = 10) const; 265 WTF_EXPORT_PRIVATE intptr_t toIntPtrStrict(bool* ok = 0, int base = 10) const; 266 267 WTF_EXPORT_PRIVATE int toInt(bool* ok = 0) const; 268 WTF_EXPORT_PRIVATE unsigned toUInt(bool* ok = 0) const; 269 269 int64_t toInt64(bool* ok = 0) const; 270 uint64_t toUInt64(bool* ok = 0) const;271 intptr_t toIntPtr(bool* ok = 0) const;272 double toDouble(bool* ok = 0, bool* didReadNumber = 0) const;273 float toFloat(bool* ok = 0, bool* didReadNumber = 0) const;270 WTF_EXPORT_PRIVATE uint64_t toUInt64(bool* ok = 0) const; 271 WTF_EXPORT_PRIVATE intptr_t toIntPtr(bool* ok = 0) const; 272 WTF_EXPORT_PRIVATE double toDouble(bool* ok = 0, bool* didReadNumber = 0) const; 273 WTF_EXPORT_PRIVATE float toFloat(bool* ok = 0, bool* didReadNumber = 0) const; 274 274 275 275 bool percentage(int& percentage) const; 276 276 277 277 // Returns a StringImpl suitable for use on another thread. 278 String crossThreadString() const;278 WTF_EXPORT_PRIVATE String crossThreadString() const; 279 279 // Makes a deep copy. Helpful only if you need to use a String on another thread 280 280 // (use crossThreadString if the method call doesn't need to be threadsafe). 281 281 // Since the underlying StringImpl objects are immutable, there's no other reason 282 282 // to ever prefer copy() over plain old assignment. 283 String threadsafeCopy() const;283 WTF_EXPORT_PRIVATE String threadsafeCopy() const; 284 284 285 285 // Prevent Strings from being implicitly convertable to bool as it will be ambiguous on any platform that … … 310 310 311 311 #if PLATFORM(WX) 312 String(const wxString&);313 operator wxString() const;312 WTF_EXPORT_PRIVATE String(const wxString&); 313 WTF_EXPORT_PRIVATE operator wxString() const; 314 314 #endif 315 315 … … 325 325 // String::fromUTF8 will return a null string if 326 326 // the input data contains invalid UTF-8 sequences. 327 static String fromUTF8(const char*, size_t);328 static String fromUTF8(const char*);327 WTF_EXPORT_PRIVATE static String fromUTF8(const char*, size_t); 328 WTF_EXPORT_PRIVATE static String fromUTF8(const char*); 329 329 330 330 // Tries to convert the passed in string to UTF-8, but will fall back to Latin-1 if the string is not valid UTF-8. 331 static String fromUTF8WithLatin1Fallback(const char*, size_t);331 WTF_EXPORT_PRIVATE static String fromUTF8WithLatin1Fallback(const char*, size_t); 332 332 333 333 // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3. … … 346 346 // Hash table deleted values, which are only constructed and never copied or destroyed. 347 347 String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { } 348 bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }348 WTF_EXPORT_PRIVATE bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); } 349 349 350 350 private: … … 416 416 } 417 417 418 int codePointCompare(const String&, const String&);418 WTF_EXPORT_PRIVATE int codePointCompare(const String&, const String&); 419 419 420 420 inline size_t find(const UChar* characters, unsigned length, UChar matchCharacter, unsigned index = 0) … … 499 499 500 500 // Shared global empty string. 501 const String& emptyString();501 WTF_EXPORT_PRIVATE const String& emptyString(); 502 502 503 503 }
Note: See TracChangeset
for help on using the changeset viewer.