Changeset 83110 in webkit
- Timestamp:
- Apr 6, 2011 3:24:32 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r83109 r83110 1 2011-04-06 Jeff Miller <jeffm@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Add WKStringGetCharactersPtr() and WKStringGetLength() to WebKit2 C API 6 https://bugs.webkit.org/show_bug.cgi?id=57989 7 8 Note that WKChar, which is returned by WKStringGetCharactersPtr(), is defined the same way we define JSChar in JSStringRef.h. 9 10 * Shared/API/c/WKString.cpp: 11 (WKStringGetLength): Added. 12 (WKStringGetCharactersPtr): Added. 13 * Shared/API/c/WKString.h: Define WKChar and added WKStringGetLength() and WKStringGetCharactersPtr(). 14 * Shared/WebString.h: 15 (WebKit::WebString::length): Added. 16 (WebKit::WebString::characters): Added. 17 1 18 2011-04-06 Anders Carlsson <andersca@apple.com> 2 19 -
trunk/Source/WebKit2/Shared/API/c/WKString.cpp
r81084 r83110 48 48 } 49 49 50 size_t WKStringGetLength(WKStringRef stringRef) 51 { 52 return toImpl(stringRef)->length(); 53 } 54 55 const WKChar* WKStringGetCharactersPtr(WKStringRef stringRef) 56 { 57 COMPILE_ASSERT(sizeof(WKChar) == sizeof(UChar), WKStringGetCharactersPtr_sizeof_WKChar_matches_UChar); 58 return reinterpret_cast<const WKChar*>(toImpl(stringRef)->characters()); 59 } 60 50 61 size_t WKStringGetMaximumUTF8CStringSize(WKStringRef stringRef) 51 62 { -
trunk/Source/WebKit2/Shared/API/c/WKString.h
r81084 r83110 37 37 #endif 38 38 39 #if !defined(WIN32) && !defined(_WIN32) && !defined(__WINSCW__) \ 40 && !((defined(__CC_ARM) || defined(__ARMCC__)) && !defined(__linux__)) /* RVCT */ 41 typedef unsigned short WKChar; 42 #else 43 typedef wchar_t WKChar; 44 #endif 45 39 46 WK_EXPORT WKTypeID WKStringGetTypeID(); 40 47 … … 42 49 43 50 WK_EXPORT bool WKStringIsEmpty(WKStringRef string); 51 52 WK_EXPORT size_t WKStringGetLength(WKStringRef string); 53 WK_EXPORT const WKChar* WKStringGetCharactersPtr(WKStringRef string); 44 54 45 55 WK_EXPORT size_t WKStringGetMaximumUTF8CStringSize(WKStringRef string); -
trunk/Source/WebKit2/Shared/WebString.h
r81084 r83110 58 58 bool isNull() const { return m_string.isNull(); } 59 59 bool isEmpty() const { return m_string.isEmpty(); } 60 61 size_t length() const { return m_string.length(); } 62 const UChar* characters() const { return m_string.characters(); } 60 63 61 64 size_t maximumUTF8CStringSize() const { return m_string.length() * 3 + 1; }
Note: See TracChangeset
for help on using the changeset viewer.