Changeset 130344 in webkit for trunk/Source/JavaScriptCore/API/OpaqueJSString.h
- Timestamp:
- Oct 3, 2012, 4:40:28 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/OpaqueJSString.h
r127958 r130344 49 49 JS_EXPORT_PRIVATE static PassRefPtr<OpaqueJSString> create(const String&); 50 50 51 UChar* characters() { return this ? m_characters: 0; }52 unsigned length() { return this ? m_length: 0; }51 const UChar* characters() { return !!this ? m_string.characters() : 0; } 52 unsigned length() { return !!this ? m_string.length() : 0; } 53 53 54 String string() const ;54 String string() const { return !!this ? m_string : String(); }; 55 55 JSC::Identifier identifier(JSC::JSGlobalData*) const; 56 56 … … 59 59 60 60 OpaqueJSString() 61 : m_characters(0)62 , m_length(0)63 61 { 62 m_string = emptyString(); 63 } 64 65 OpaqueJSString(const String& string) 66 { 67 // Make a copy of the source string. 68 if (string.is8Bit()) 69 m_string = String(string.characters8(), string.length()); 70 else 71 m_string = String(string.characters16(), string.length()); 64 72 } 65 73 66 74 OpaqueJSString(const UChar* characters, unsigned length) 67 : m_length(length)68 75 { 69 m_characters = new UChar[length]; 70 memcpy(m_characters, characters, length * sizeof(UChar)); 76 m_string = String(characters, length); 71 77 } 72 78 73 ~OpaqueJSString() 74 { 75 delete[] m_characters; 76 } 77 78 UChar* m_characters; 79 unsigned m_length; 79 String m_string; 80 80 }; 81 81
Note:
See TracChangeset
for help on using the changeset viewer.