VirtualBox

Changeset 39277 in vbox for trunk/include/iprt/cpp


Ignore:
Timestamp:
Nov 11, 2011 4:22:46 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74827
Message:

Runtime: split should really be const; add RTCStringFmt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/ministring.h

    r36532 r39277  
    826826     */
    827827    RTCList<RTCString, RTCString *> split(const RTCString &a_rstrSep,
    828                                           SplitMode a_enmMode = RemoveEmptyParts);
     828                                          SplitMode a_enmMode = RemoveEmptyParts) const;
    829829
    830830    /**
     
    953953RTDECL(const RTCString) operator+(const char *a_psz1, const RTCString &a_rstr2);
    954954
     955/**
     956 * Class with RTCString::printf as constructor for your convenience.
     957 *
     958 * Constructing a RTCString string object from a format string and a variable
     959 * number of arguments can easily be confused with the other RTCString
     960 * constructors, thus this child class.
     961 *
     962 * The usage of this class is like the following:
     963 * @code
     964    RTCStringFmt strName("program name = %s", argv[0]);
     965   @endcode
     966 */
     967class RTCStringFmt : public RTCString
     968{
     969public:
     970
     971    /**
     972     * Constructs a new string given the format string and the list of the
     973     * arguments for the format string.
     974     *
     975     * @param   a_pszFormat     Pointer to the format string (UTF-8),
     976     *                          @see pg_rt_str_format.
     977     * @param   ...             Ellipsis containing the arguments specified by
     978     *                          the format string.
     979     */
     980    explicit RTCStringFmt(const char *a_pszFormat, ...)
     981    {
     982        va_list va;
     983        va_start(va, a_pszFormat);
     984        printfV(a_pszFormat, va);
     985        va_end(va);
     986    }
     987
     988    RTMEMEF_NEW_AND_DELETE_OPERATORS();
     989
     990protected:
     991    RTCStringFmt() {}
     992};
     993
    955994/** @} */
    956995
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette