Changeset 57055 in webkit for trunk/JavaScriptCore/runtime/UString.h
- Timestamp:
- Apr 3, 2010, 11:53:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/UString.h
r56864 r57055 49 49 50 50 public: 51 UString() ;51 UString() {} 52 52 UString(const char*); // Constructor for null-terminated string. 53 53 UString(const char*, unsigned length); … … 63 63 UString(PlacementNewAdoptType) 64 64 : m_rep(PlacementNewAdopt) 65 {66 }67 68 ~UString()69 65 { 70 66 } … … 96 92 CString UTF8String(bool strict = false) const; 97 93 98 const UChar* data() const { return m_rep->characters(); } 99 100 bool isNull() const { return m_rep == s_nullRep; } 101 bool isEmpty() const { return !m_rep->length(); } 94 const UChar* data() const 95 { 96 if (!m_rep) 97 return 0; 98 return m_rep->characters(); 99 } 100 101 unsigned size() const 102 { 103 if (!m_rep) 104 return 0; 105 return m_rep->length(); 106 } 107 108 bool isNull() const { return !m_rep; } 109 bool isEmpty() const { return !m_rep || !m_rep->length(); } 102 110 103 111 bool is8Bit() const; 104 105 unsigned size() const { return m_rep->length(); }106 112 107 113 UChar operator[](unsigned pos) const; … … 132 138 : m_rep(r) 133 139 { 134 ASSERT(m_rep); 135 } 136 137 size_t cost() const { return m_rep->cost(); } 140 } 141 142 size_t cost() const 143 { 144 if (!m_rep) 145 return 0; 146 return m_rep->cost(); 147 } 138 148 139 149 private: 140 150 RefPtr<Rep> m_rep; 141 151 142 JS_EXPORTDATA static Rep* s_nullRep;143 152 static UString* s_nullUString; 144 153 … … 194 203 195 204 int compare(const UString&, const UString&); 196 197 inline UString::UString()198 : m_rep(s_nullRep)199 {200 }201 205 202 206 // Rule from ECMA 15.2 about what an array index is.
Note:
See TracChangeset
for help on using the changeset viewer.