Changeset 15376 in webkit for trunk/JavaScriptCore/API/JSInternalStringRef.h
- Timestamp:
- Jul 12, 2006, 1:12:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSInternalStringRef.h
r15328 r15376 29 29 30 30 #include <JavaScriptCore/JSValueRef.h> 31 32 #include <stdbool.h> 33 #include <stddef.h> // for size_t 34 31 35 #ifdef __cplusplus 32 36 extern "C" { … … 46 50 @function 47 51 @abstract Creates a JavaScript string from a buffer of Unicode characters. 48 @param chars The buffer of Unicode characters to copy into the new JS InternalString.52 @param chars The buffer of Unicode characters to copy into the new JSString. 49 53 @param numChars The number of characters to copy from the buffer pointed to by chars. 50 @result A JS InternalString containing chars. Ownership follows the create rule.54 @result A JSString containing chars. Ownership follows the Create Rule. 51 55 */ 52 JS InternalStringRef JSInternalStringCreate(const JSChar* chars, size_t numChars);56 JSStringRef JSStringCreateWithCharacters(const JSChar* chars, size_t numChars); 53 57 /*! 54 58 @function 55 59 @abstract Creates a JavaScript string from a null-terminated UTF8 string. 56 @param string The null-terminated UTF8 string to copy into the new JS InternalString.57 @result A JS InternalString containing string. Ownership follows the create rule.60 @param string The null-terminated UTF8 string to copy into the new JSString. 61 @result A JSString containing string. Ownership follows the Create Rule. 58 62 */ 59 JS InternalStringRef JSInternalStringCreateUTF8(const char* string);63 JSStringRef JSStringCreateWithUTF8CString(const char* string); 60 64 61 65 /*! 62 66 @function 63 67 @abstract Retains a JavaScript string. 64 @param string The JS InternalString to retain.65 @result A JS InternalString that is the same as buffer.68 @param string The JSString to retain. 69 @result A JSString that is the same as string. 66 70 */ 67 JS InternalStringRef JSInternalStringRetain(JSInternalStringRef string);71 JSStringRef JSStringRetain(JSStringRef string); 68 72 /*! 69 73 @function 70 74 @abstract Releases a JavaScript string. 71 @param string The JS InternalString to release.75 @param string The JSString to release. 72 76 */ 73 void JS InternalStringRelease(JSInternalStringRef string);77 void JSStringRelease(JSStringRef string); 74 78 75 79 /*! 76 80 @function 77 81 @abstract Returns the number of Unicode characters in a JavaScript string. 78 @param string The JS InternalString whose length (in Unicode characters) you want to know.82 @param string The JSString whose length (in Unicode characters) you want to know. 79 83 @result The number of Unicode characters stored in string. 80 84 */ 81 size_t JS InternalStringGetLength(JSInternalStringRef string);85 size_t JSStringGetLength(JSStringRef string); 82 86 /*! 83 87 @function 84 @abstract Quickly obtains a pointer to the Unicode character buffer that88 @abstract Returns a pointer to the Unicode character buffer that 85 89 serves as the backing store for a JavaScript string. 86 @param string The JS InternalString whose backing store you want to access.90 @param string The JSString whose backing store you want to access. 87 91 @result A pointer to the Unicode character buffer that serves as string's 88 92 backing store, which will be deallocated when string is deallocated. 89 93 */ 90 const JSChar* JSInternalStringGetCharactersPtr(JSInternalStringRef string); 91 /*! 92 @function 93 @abstract Copies a JavaScript string's Unicode characters into an 94 external character buffer. 95 @param string The source JSInternalString. 96 @param buffer The destination JSChar buffer into which to copy string's 97 characters. On return, buffer contains the requested Unicode characters. 98 @param numChars The number of Unicode characters to copy. This number must not 99 exceed the length of the string. 100 */ 101 void JSInternalStringGetCharacters(JSInternalStringRef string, JSChar* buffer, size_t numChars); 94 const JSChar* JSStringGetCharactersPtr(JSStringRef string); 102 95 103 96 /*! 104 97 @function 105 @abstract Returns the maximum number of bytes required to encode the106 contents of a JavaScript string asa null-terminated UTF8 string.107 @param string The JSInternalString whose maximum encoded length(in bytes) you98 @abstract Returns the maximum number of bytes a JavaScript string will 99 take up if converted into a null-terminated UTF8 string. 100 @param string The JSString whose maximum converted size (in bytes) you 108 101 want to know. 109 @result The maximum number of bytes required to encode string's contents 110 as a null-terminated UTF8 string. 102 @result The maximum number of bytes that could be required to convert string into a 103 null-terminated UTF8 string. The number of bytes that the conversion actually ends 104 up requiring could be less than this, but never more. 111 105 */ 112 size_t JS InternalStringGetMaxLengthUTF8(JSInternalStringRef string);106 size_t JSStringGetMaximumUTF8CStringSize(JSStringRef string); 113 107 /*! 114 108 @function 115 @abstract Converts a JavaScript string's contents into a116 null-terminated UTF8 string,and copies the result into an external byte buffer.117 @param string The source JSInternalString.118 @param buffer The destination byte buffer into which to copy a UTF8 string119 representation of string. The buffer must be at least bufferSize bytes in length.120 On return, buffer contains a UTF8 string representation of string.109 @abstract Converts a JavaScript string into a null-terminated UTF8 string, 110 and copies the result into an external byte buffer. 111 @param string The source JSString. 112 @param buffer The destination byte buffer into which to copy a null-terminated 113 UTF8 string representation of string. The buffer must be at least bufferSize 114 bytes in size. On return, buffer contains a UTF8 string representation of string. 121 115 If bufferSize is too small, buffer will contain only partial results. 122 @param bufferSize The lengthof the external buffer in bytes.123 @result 116 @param bufferSize The size of the external buffer in bytes. 117 @result The number of bytes written into buffer (including the null-terminator byte). 124 118 */ 125 size_t JS InternalStringGetCharactersUTF8(JSInternalStringRef string, char* buffer, size_t bufferSize);119 size_t JSStringGetUTF8CString(JSStringRef string, char* buffer, size_t bufferSize); 126 120 127 121 /*! 128 122 @function 129 @abstract Tests whether t he characters in two JavaScript strings match.130 @param a The first JS InternalString to test.131 @param b The second JS InternalString to test.132 @result true if the characters in thetwo strings match, otherwise false.123 @abstract Tests whether two JavaScript strings match. 124 @param a The first JSString to test. 125 @param b The second JSString to test. 126 @result true if the two strings match, otherwise false. 133 127 */ 134 bool JS InternalStringIsEqual(JSInternalStringRef a, JSInternalStringRef b);128 bool JSStringIsEqual(JSStringRef a, JSStringRef b); 135 129 /*! 136 130 @function 137 @abstract Tests whether the characters in a JavaScript string match 138 the characters in a null-terminated UTF8 string. 139 @param a The JSInternalString to test. 131 @abstract Tests whether a JavaScript string matches a null-terminated UTF8 string. 132 @param a The JSString to test. 140 133 @param b The null-terminated UTF8 string to test. 141 @result true if the characters in thetwo strings match, otherwise false.134 @result true if the two strings match, otherwise false. 142 135 */ 143 bool JS InternalStringIsEqualUTF8(JSInternalStringRef a, const char* b);136 bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b); 144 137 145 138 #if defined(__APPLE__) … … 151 144 @discussion This function is optimized to take advantage of cases when 152 145 CFStringGetCharactersPtr returns a valid pointer. 153 @param string The CFString to copy into the new JS InternalString.154 @result A JS InternalString containing string. Ownership follows the create rule.146 @param string The CFString to copy into the new JSString. 147 @result A JSString containing string. Ownership follows the Create Rule. 155 148 */ 156 JS InternalStringRef JSInternalStringCreateCF(CFStringRef string);149 JSStringRef JSStringCreateWithCFString(CFStringRef string); 157 150 /*! 158 151 @function 159 152 @abstract Creates a CFString form a JavaScript string. 160 153 @param alloc The alloc parameter to pass to CFStringCreate. 161 @param string The JS InternalString to copy into the new CFString.162 @result A CFString containing string. Ownership follows the create rule.154 @param string The JSString to copy into the new CFString. 155 @result A CFString containing string. Ownership follows the Create Rule. 163 156 */ 164 CFStringRef CFStringCreateWithJSInternalString(CFAllocatorRef alloc, JSInternalStringRef string);157 CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string); 165 158 #endif // __APPLE__ 166 159
Note:
See TracChangeset
for help on using the changeset viewer.