Changeset 36527 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Apr 4, 2011 1:16:09 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70949
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/ministring.cpp
r36508 r36527 33 33 *******************************************************************************/ 34 34 #include <iprt/cpp/ministring.h> 35 using namespace iprt;36 35 37 36 … … 39 38 * Global Variables * 40 39 *******************************************************************************/ 41 const size_t MiniString::npos = ~(size_t)0; 40 const size_t RTCString::npos = ~(size_t)0; 41 42 42 43 43 /******************************************************************************* … … 48 48 49 49 50 MiniString &MiniString::printf(const char *pszFormat, ...)50 RTCString &RTCString::printf(const char *pszFormat, ...) 51 51 { 52 52 va_list va; … … 58 58 59 59 /** 60 * Callback used with RTStrFormatV by MiniString::printfV.60 * Callback used with RTStrFormatV by RTCString::printfV. 61 61 * 62 62 * @returns The number of bytes added (not used). … … 67 67 */ 68 68 /*static*/ DECLCALLBACK(size_t) 69 MiniString::printfOutputCallback(void *pvArg, const char *pachChars, size_t cbChars)70 { 71 MiniString *pThis = (MiniString *)pvArg;69 RTCString::printfOutputCallback(void *pvArg, const char *pachChars, size_t cbChars) 70 { 71 RTCString *pThis = (RTCString *)pvArg; 72 72 if (cbChars) 73 73 { … … 94 94 } 95 95 96 MiniString &MiniString::printfV(const char *pszFormat, va_list va)96 RTCString &RTCString::printfV(const char *pszFormat, va_list va) 97 97 { 98 98 cleanup(); … … 101 101 } 102 102 103 MiniString &MiniString::append(const MiniString &that)103 RTCString &RTCString::append(const RTCString &that) 104 104 { 105 105 size_t cchThat = that.length(); … … 125 125 } 126 126 127 MiniString &MiniString::append(const char *pszThat)127 RTCString &RTCString::append(const char *pszThat) 128 128 { 129 129 size_t cchThat = strlen(pszThat); … … 149 149 } 150 150 151 MiniString& MiniString::append(char ch)151 RTCString& RTCString::append(char ch) 152 152 { 153 153 Assert((unsigned char)ch < 0x80); /* Don't create invalid UTF-8. */ … … 170 170 } 171 171 172 MiniString &MiniString::appendCodePoint(RTUNICP uc)172 RTCString &RTCString::appendCodePoint(RTUNICP uc) 173 173 { 174 174 /* … … 176 176 */ 177 177 if (uc < 0x80) 178 return MiniString::append((char)uc);178 return RTCString::append((char)uc); 179 179 180 180 /* … … 200 200 } 201 201 202 size_t MiniString::find(const char *pcszFind, size_t pos /*= 0*/) const202 size_t RTCString::find(const char *pcszFind, size_t pos /*= 0*/) const 203 203 { 204 204 const char *pszThis, *p; … … 213 213 } 214 214 215 void MiniString::findReplace(char cFind, char cReplace)215 void RTCString::findReplace(char cFind, char cReplace) 216 216 { 217 217 for (size_t i = 0; i < length(); ++i) … … 223 223 } 224 224 225 MiniString MiniString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) const226 { 227 MiniString ret;225 RTCString RTCString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) const 226 { 227 RTCString ret; 228 228 229 229 if (n) … … 271 271 } 272 272 273 bool MiniString::endsWith(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const273 bool RTCString::endsWith(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const 274 274 { 275 275 size_t l1 = length(); … … 289 289 } 290 290 291 bool MiniString::startsWith(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const291 bool RTCString::startsWith(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const 292 292 { 293 293 size_t l1 = length(); … … 304 304 } 305 305 306 bool MiniString::contains(const MiniString &that, CaseSensitivity cs /*= CaseSensitive*/) const306 bool RTCString::contains(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const 307 307 { 308 308 /** @todo r-bird: Not checking for NULL strings like startsWith does (and … … 313 313 } 314 314 315 int MiniString::toInt(uint64_t &i) const315 int RTCString::toInt(uint64_t &i) const 316 316 { 317 317 if (!m_psz) … … 320 320 } 321 321 322 int MiniString::toInt(uint32_t &i) const322 int RTCString::toInt(uint32_t &i) const 323 323 { 324 324 if (!m_psz) … … 327 327 } 328 328 329 iprt::list< iprt::MiniString, iprt::MiniString *>330 MiniString::split(const iprt::MiniString &a_rstrSep, SplitMode mode /* = RemoveEmptyParts */)331 { 332 iprt::list< iprt::MiniString> strRet;329 iprt::list<RTCString, RTCString *> 330 RTCString::split(const RTCString &a_rstrSep, SplitMode mode /* = RemoveEmptyParts */) 331 { 332 iprt::list<RTCString> strRet; 333 333 if (!m_psz) 334 334 return strRet; 335 335 if (a_rstrSep.isEmpty()) 336 336 { 337 strRet.append( iprt::MiniString(m_psz));337 strRet.append(RTCString(m_psz)); 338 338 return strRet; 339 339 } … … 346 346 if (!pszNext) 347 347 { 348 strRet.append( iprt::MiniString(pszTmp, cch));348 strRet.append(RTCString(pszTmp, cch)); 349 349 break; 350 350 } … … 352 352 if ( cchNext > 0 353 353 || mode == KeepEmptyParts) 354 strRet.append( iprt::MiniString(pszTmp, cchNext));354 strRet.append(RTCString(pszTmp, cchNext)); 355 355 pszTmp += cchNext + a_rstrSep.length(); 356 356 cch -= cchNext + a_rstrSep.length(); … … 361 361 362 362 /* static */ 363 iprt::MiniString364 MiniString::join(const iprt::list<iprt::MiniString, iprt::MiniString*> &a_rList,365 const iprt::MiniString &a_rstrSep /* = "" */)366 { 367 MiniString strRet;363 RTCString 364 RTCString::join(const iprt::list<RTCString, RTCString*> &a_rList, 365 const RTCString &a_rstrSep /* = "" */) 366 { 367 RTCString strRet; 368 368 if (a_rList.size() > 1) 369 369 { … … 376 376 } 377 377 378 const iprt::MiniString operator+(const iprt::MiniString &a_rStr1, const iprt::MiniString &a_rStr2)379 { 380 iprt::MiniString strRet(a_rStr1);378 const RTCString operator+(const RTCString &a_rStr1, const RTCString &a_rStr2) 379 { 380 RTCString strRet(a_rStr1); 381 381 strRet += a_rStr2; 382 382 return strRet; 383 383 } 384 384 385 const iprt::MiniString operator+(const iprt::MiniString &a_rStr1, const char *a_pszStr2)386 { 387 iprt::MiniString strRet(a_rStr1);385 const RTCString operator+(const RTCString &a_rStr1, const char *a_pszStr2) 386 { 387 RTCString strRet(a_rStr1); 388 388 strRet += a_pszStr2; 389 389 return strRet; 390 390 } 391 391 392 const iprt::MiniString operator+(const char *a_psz1, const iprt::MiniString &a_rStr2)393 { 394 iprt::MiniString strRet(a_psz1);392 const RTCString operator+(const char *a_psz1, const RTCString &a_rStr2) 393 { 394 RTCString strRet(a_psz1); 395 395 strRet += a_rStr2; 396 396 return strRet;
Note:
See TracChangeset
for help on using the changeset viewer.