VirtualBox

Changeset 93105 in vbox


Ignore:
Timestamp:
Dec 30, 2021 11:34:31 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149119
Message:

Main/glue: Added Bstr::startsWith methods.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/string.h

    r91519 r93105  
    357357
    358358    /**
     359     * Checks if the string starts with @a a_rStart.
     360     */
     361    bool startsWith(Bstr const &a_rStart) const;
     362    /**
     363     * Checks if the string starts with @a a_rStart.
     364     */
     365    bool startsWith(RTCString const &a_rStart) const;
     366    /**
     367     * Checks if the string starts with @a a_pszStart.
     368     */
     369    bool startsWith(const char *a_pszStart) const;
     370
     371    /**
    359372     * Returns true if the member string has no length.
    360373     * This is true for instances created from both NULL and "" input strings.
  • trunk/src/VBox/Main/glue/string.cpp

    r85314 r93105  
    272272        return ucLeft < ucRight ? -1 : 1;
    273273    }
     274}
     275
     276
     277bool Bstr::startsWith(Bstr const &a_rStart) const
     278{
     279    return RTUtf16NCmp(m_bstr, a_rStart.m_bstr, a_rStart.length()) == 0;
     280}
     281
     282
     283bool Bstr::startsWith(RTCString const &a_rStart) const
     284{
     285    return RTUtf16NCmpUtf8(m_bstr, a_rStart.c_str(), RTSTR_MAX, a_rStart.length()) == 0;
     286}
     287
     288
     289bool Bstr::startsWith(const char *a_pszStart) const
     290{
     291    return RTUtf16NCmpUtf8(m_bstr, a_pszStart, RTSTR_MAX, strlen(a_pszStart)) == 0;
    274292}
    275293
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