Changeset 26587 in vbox for trunk/include/iprt
- Timestamp:
- Feb 16, 2010 4:57:09 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57775
- Location:
- trunk/include/iprt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r26226 r26587 1920 1920 #if defined(_MSC_VER) 1921 1921 # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) \ 1922 inline bool operator! (const Cls &that) { return !bool 1923 inline bool operator&& (const Cls &that, bool b) { return bool 1924 inline bool operator|| (const Cls &that, bool b) { return bool 1925 inline bool operator&& (bool b, const Cls &that) { return b && bool 1926 inline bool operator|| (bool b, const Cls &that) { return b || bool 1922 inline bool operator! (const Cls &that) { return !bool(that); } \ 1923 inline bool operator&& (const Cls &that, bool b) { return bool(that) && b; } \ 1924 inline bool operator|| (const Cls &that, bool b) { return bool(that) || b; } \ 1925 inline bool operator&& (bool b, const Cls &that) { return b && bool(that); } \ 1926 inline bool operator|| (bool b, const Cls &that) { return b || bool(that); } 1927 1927 #else 1928 1928 # define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) -
trunk/include/iprt/cpp/ministring.h
r26553 r26587 45 45 * else except IPRT memory management functions. Semantics are like in 46 46 * std::string, except it can do a lot less. 47 * 48 * Note that MiniString does not differentiate between NULL strings and 49 * empty strings. In other words, MiniString("") and MiniString(NULL) 50 * behave the same. In both cases, MiniString allocates no memory, reports 51 * a zero length and zero allocated bytes for both, and returns an empty 52 * C string from c_str(). 47 53 */ 48 54 #ifdef VBOX … … 71 77 * Creates a copy of another MiniString. 72 78 * 73 * This allocates s.length() + 1 bytes for the new instance .79 * This allocates s.length() + 1 bytes for the new instance, unless s is empty. 74 80 * 75 81 * @param s The source string. … … 83 89 84 90 /** 85 * Creates a copy of a nother MiniString.86 * 87 * This allocates strlen(pcsz) + 1 bytes for the new instance .91 * Creates a copy of a C string. 92 * 93 * This allocates strlen(pcsz) + 1 bytes for the new instance, unless s is empty. 88 94 * 89 95 * @param pcsz The source string. … … 123 129 * 124 130 * Returns the number of bytes allocated in the internal string buffer, which is 125 * at least length() + 1 if length() > 0. 131 * at least length() + 1 if length() > 0. Returns 0 for an empty string. 126 132 * 127 133 * @returns m_cbAllocated. … … 275 281 * Returns the byte at the given index, or a null byte if the index is not 276 282 * smaller than length(). This does _not_ count codepoints but simply points 277 * into the member C string .283 * into the member C string; the result may not be a valid UTF-8 character. 278 284 * 279 285 * @param i The index into the string buffer. … … 289 295 /** 290 296 * Returns the contained string as a C-style const char* pointer. 297 * This never returns NULL; if the string is empty, returns a 298 * pointer to static null byte. 291 299 * 292 300 * @returns const pointer to C-style string. … … 294 302 inline const char *c_str() const 295 303 { 296 return m_psz;304 return (m_psz) ? m_psz : ""; 297 305 } 298 306 299 307 /** 300 308 * Like c_str(), for compatibility with lots of VirtualBox Main code. 309 * This never returns NULL; if the string is empty, returns a 310 * pointer to static null byte. 301 311 * 302 312 * @returns const pointer to C-style string. … … 304 314 inline const char *raw() const 305 315 { 306 return m_psz;307 } 308 309 /** 310 * Empt ry string or not?316 return (m_psz) ? m_psz : ""; 317 } 318 319 /** 320 * Empty string or not? 311 321 * 312 322 * Returns true if the member string has no length. This states nothing about … … 472 482 473 483 /** 474 * Hide operator bool() to force people to use isEmpty() explicitly.475 */476 operator bool() const { return false; }477 478 /**479 484 * Destructor implementation, also used to clean up in operator=() before 480 485 * assigning a new string. … … 492 497 493 498 /** 494 * Protected internal helper for copy a string that completely ignors the 495 * current object state. 499 * Protected internal helper to copy a string, ignoring the previous object state. 496 500 * 497 501 * copyFrom() unconditionally sets the members to a copy of the given other … … 501 505 * 502 506 * This variant copies from another MiniString and is fast since 503 * the length of source string is known.507 * the length of the source string is known. 504 508 * 505 509 * @param s The source string. … … 533 537 534 538 /** 535 * Protected internal helper for copy a string that completely ignors the 536 * current object state. 539 * Protected internal helper to copy a string, ignoring the previous object state. 537 540 * 538 541 * See copyFrom() above. … … 572 575 } 573 576 577 private: 578 579 /** 580 * Hide operator bool() to force people to use isEmpty() explicitly. 581 */ 582 operator bool() const; 583 584 protected: 585 574 586 char *m_psz; /**< The string buffer. */ 575 587 size_t m_cbLength; /**< strlen(m_psz) - i.e. no terminator included. */
Note:
See TracChangeset
for help on using the changeset viewer.