Changeset 42570 in vbox for trunk/include/VBox/com
- Timestamp:
- Aug 3, 2012 9:56:09 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/string.h
r42177 r42570 559 559 bool operator<(const RTCString &that) const { return RTCString::operator<(that); } 560 560 561 /** 562 * Extended assignment method that returns a COM status code instead of an 563 * exception on failure. 564 * 565 * @returns S_OK or E_OUTOFMEMORY. 566 * @param a_rSrcStr The source string 567 */ 568 HRESULT assignEx(Utf8Str const &a_rSrcStr) 569 { 570 return copyFromExNComRC(a_rSrcStr.m_psz, a_rSrcStr.m_cch); 571 } 572 573 /** 574 * Extended assignment method that returns a COM status code instead of an 575 * exception on failure. 576 * 577 * @returns S_OK, E_OUTOFMEMORY or E_INVALIDARG. 578 * @param a_pcszSrc The source string 579 * @param a_offSrc The character (byte) offset of the substring. 580 * @param a_cchSrc The number of characters (bytes) to copy from the source 581 * string. 582 */ 583 HRESULT assignEx(Utf8Str const &a_rSrcStr, size_t a_offSrc, size_t a_cchSrc) 584 { 585 if ( a_offSrc + a_cchSrc > a_rSrcStr.m_cch 586 || a_offSrc > a_rSrcStr.m_cch) 587 return E_INVALIDARG; 588 return copyFromExNComRC(a_rSrcStr.m_psz, a_rSrcStr.m_cch); 589 } 590 591 /** 592 * Extended assignment method that returns a COM status code instead of an 593 * exception on failure. 594 * 595 * @returns S_OK or E_OUTOFMEMORY. 596 * @param a_pcszSrc The source string 597 */ 598 HRESULT assignEx(const char *a_pcszSrc) 599 { 600 return copyFromExNComRC(a_pcszSrc, a_pcszSrc ? strlen(a_pcszSrc) : 0); 601 } 602 603 /** 604 * Extended assignment method that returns a COM status code instead of an 605 * exception on failure. 606 * 607 * @returns S_OK or E_OUTOFMEMORY. 608 * @param a_pcszSrc The source string 609 * @param a_cchSrc The number of characters (bytes) to copy from the source 610 * string. 611 */ 612 HRESULT assignEx(const char *a_pcszSrc, size_t a_cchSrc) 613 { 614 return copyFromExNComRC(a_pcszSrc, a_cchSrc); 615 } 616 561 617 RTMEMEF_NEW_AND_DELETE_OPERATORS(); 562 618 … … 655 711 void copyFrom(CBSTR a_pbstr); 656 712 HRESULT copyFromEx(CBSTR a_pbstr); 713 HRESULT copyFromExNComRC(const char *a_pcszSrc, size_t a_cchSrc); 657 714 658 715 friend class Bstr; /* to access our raw_copy() */
Note:
See TracChangeset
for help on using the changeset viewer.