VirtualBox

Changeset 67688 in vbox for trunk/include


Ignore:
Timestamp:
Jun 29, 2017 11:46:07 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116516
Message:

RTCString: Added 4 standard like replace() methods.

File:
1 edited

Legend:

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

    r67676 r67688  
    500500        return *this;
    501501    }
     502
     503    /**
     504     * Replaces a span of @a this string with a replacement string.
     505     *
     506     * @returns Reference to the object.
     507     * @param   offStart        Where in @a this string to start replacing.
     508     * @param   cchLength       How much following @a offStart to replace.  npos is
     509     *                          accepted.
     510     * @param   rStrReplacement The replacement string.
     511     *
     512     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
     513     *
     514     * @note    Non-standard behaviour if offStart is beyond the end of the string.
     515     *          No change will occure and strict builds hits a debug assertion.
     516     */
     517    RTCString &replace(size_t offStart, size_t cchLength, const RTCString &rStrReplacement);
     518
     519    /**
     520     * Replaces a span of @a this string with a replacement substring.
     521     *
     522     * @returns Reference to the object.
     523     * @param   offStart        Where in @a this string to start replacing.
     524     * @param   cchLength       How much following @a offStart to replace.  npos is
     525     *                          accepted.
     526     * @param   rStrReplacement The string from which a substring is taken.
     527     * @param   offReplacement  The offset into @a rStrReplacement where the
     528     *                          replacement substring starts.
     529     * @param   cchReplacment   The maximum length of the replacement substring.
     530     *
     531     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
     532     *
     533     * @note    Non-standard behaviour if offStart or offReplacement is beyond the
     534     *          end of the repective strings.  No change is made in the former case,
     535     *          while we consider it an empty string in the latter.  In both
     536     *          situation a debug assertion is raised in strict builds.
     537     */
     538    RTCString &replace(size_t offStart, size_t cchLength, const RTCString &rStrReplacement,
     539                       size_t offReplacement, size_t cchReplacement);
     540
     541    /**
     542     * Replaces a span of @a this string with the replacement string.
     543     *
     544     * @returns Reference to the object.
     545     * @param   offStart        Where in @a this string to start replacing.
     546     * @param   cchLength       How much following @a offStart to replace.  npos is
     547     *                          accepted.
     548     * @param   pszReplacement  The replacement string.
     549     *
     550     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
     551     *
     552     * @note    Non-standard behaviour if offStart is beyond the end of the string.
     553     *          No change will occure and strict builds hits a debug assertion.
     554     */
     555    RTCString &replace(size_t offStart, size_t cchLength, const char *pszReplacement);
     556
     557    /**
     558     * Replaces a span of @a this string with the replacement string.
     559     *
     560     * @returns Reference to the object.
     561     * @param   offStart        Where in @a this string to start replacing.
     562     * @param   cchLength       How much following @a offStart to replace.  npos is
     563     *                          accepted.
     564     * @param   pszReplacement  The replacement string.
     565     * @param   cchReplacement  How much of @a pszReplacement to use at most.  If a
     566     *                          zero terminator is found before reaching this value,
     567     *                          we'll stop there.
     568     *
     569     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
     570     *
     571     * @note    Non-standard behaviour if offStart is beyond the end of the string.
     572     *          No change will occure and strict builds hits a debug assertion.
     573     */
     574    RTCString &replace(size_t offStart, size_t cchLength, const char *pszReplacement, size_t cchReplacement);
    502575
    503576    /**
     
    10681141     * This is an internal worker for the append() methods.
    10691142     *
     1143     * @returns Reference to the object.
    10701144     * @param   pszSrc          The source string.
    10711145     * @param   cchSrc          The source string length (exact).
    10721146     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
    10731147     *
    1074      * @returns Reference to the object.
    10751148     */
    10761149    RTCString &appendWorker(const char *pszSrc, size_t cchSrc);
     1150
     1151    /**
     1152     * Replaces exatly @a cchLength chars at @a offStart with @a cchSrc from @a
     1153     * pszSrc.
     1154     *
     1155     * @returns Reference to the object.
     1156     * @param   offStart        Where in @a this string to start replacing.
     1157     * @param   cchLength       How much following @a offStart to replace.  npos is
     1158     *                          accepted.
     1159     * @param   pszSrc          The replacement string.
     1160     * @param   cchSrc          The exactly length of the replacement string.
     1161     *
     1162     * @throws  std::bad_alloc  On allocation error.  The object is left unchanged.
     1163     */
     1164    RTCString &replaceWorker(size_t offStart, size_t cchLength, const char *pszSrc, size_t cchSrc);
    10771165
    10781166    static DECLCALLBACK(size_t) printfOutputCallback(void *pvArg, const char *pachChars, size_t cbChars);
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