VirtualBox

Changeset 21588 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 14, 2009 4:22:06 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50084
Message:

Main: move vbox-independent OVF reader code to separate file; move some more string implementation from com::UTF8Str to iprt::MiniString

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/ministring_cpp.h

    r21409 r21588  
    307307    bool operator<(const char *that) const { return compare(that) < 0; }
    308308    bool operator>(const char *that) const { return compare(that) > 0; }
     309
     310    static const size_t npos;
     311
     312    /**
     313     * Looks for pcszFind in "this" starting at "pos" and returns its position,
     314     * counting from the beginning of "this" at 0. Returns npos if not found.
     315     */
     316    size_t find(const char *pcszFind, size_t pos = 0) const;
     317
     318    /**
     319     * Returns a substring of "this" as a new Utf8Str. Works exactly like
     320     * its equivalent in std::string except that this interprets pos and n
     321     * as UTF-8 codepoints instead of bytes. With the default parameters "0"
     322     * and "npos", this always copies the entire string.
     323     * @param pos Index of first codepoint to copy from "this", counting from 0.
     324     * @param n Number of codepoints to copy, starting with the one at "pos".
     325     */
     326    iprt::MiniString substr(size_t pos = 0, size_t n = npos) const;
     327
     328    /**
     329     * Returns true if "this" ends with "that".
     330     * @param that
     331     * @param cs
     332     * @return
     333     */
     334    bool endsWith(const iprt::MiniString &that, CaseSensitivity cs = CaseSensitive) const;
     335
     336    /**
     337     * Returns true if "this" begins with "that".
     338     * @return
     339     */
     340    bool startsWith(const iprt::MiniString &that, CaseSensitivity cs = CaseSensitive) const;
     341
     342    /**
     343     * Returns true if "this" contains "that" (strstr).
     344     * @param that
     345     * @param cs
     346     * @return
     347     */
     348    bool contains(const iprt::MiniString &that, CaseSensitivity cs = CaseSensitive) const;
     349
     350    /**
     351     * Attempts to convert the member string into an 64-bit integer.
     352     *
     353     * @returns 64-bit unsigned number on success.
     354     * @returns 0 on failure.
     355     */
     356    int64_t toInt64() const
     357    {
     358        return RTStrToInt64(m_psz);
     359    }
     360
     361    /**
     362     * Attempts to convert the member string into an unsigned 64-bit integer.
     363     *
     364     * @returns 64-bit unsigned number on success.
     365     * @returns 0 on failure.
     366     */
     367    uint64_t toUInt64() const
     368    {
     369        return RTStrToUInt64(m_psz);
     370    }
     371
     372    /**
     373     * Attempts to convert the member string into an unsigned 64-bit integer.
     374     * @return IPRT error code.
     375     * @param i Output buffer.
     376     */
     377    int toInt(uint64_t &i) const;
     378
     379    /**
     380     * Attempts to convert the member string into an unsigned 32-bit integer.
     381     * @return IPRT error code.
     382     * @param i Output buffer.
     383     */
     384    int toInt(uint32_t &i) const;
    309385
    310386protected:
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