VirtualBox

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


Ignore:
Timestamp:
Sep 11, 2018 2:49:55 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124973
Message:

IPRT/rest: String map tests. A couple of bugfixes (removal, enumeration). bugref:9167

File:
1 edited

Legend:

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

    r74195 r74197  
    8383     * @param   a_pszKey   The key to check fo.
    8484     */
    85     bool constainsKey(const char *a_pszKey) const;
     85    bool containsKey(const char *a_pszKey) const;
    8686
    8787    /**
     
    9090     * @param   a_rStrKey   The key to check fo.
    9191     */
    92     bool constainsKey(RTCString const &a_rStrKey) const;
     92    bool containsKey(RTCString const &a_rStrKey) const;
    9393
    9494    /**
     
    193193
    194194    /** Returns iterator for the first map entry (unless it's empty and it's also the end). */
    195     inline ConstIterator begin() const { return ConstIterator(RTListGetFirstCpp(&m_ListHead, MapEntry, ListEntry)); }
     195    inline ConstIterator begin() const
     196    {
     197        if (!RTListIsEmpty(&m_ListHead))
     198            return ConstIterator(RTListNodeGetNextCpp(&m_ListHead, MapEntry, ListEntry));
     199        return end();
     200    }
    196201    /** Returns iterator for the last map entry (unless it's empty and it's also the end). */
    197     inline ConstIterator last() const  { return ConstIterator(RTListGetLastCpp(&m_ListHead, MapEntry, ListEntry)); }
     202    inline ConstIterator last() const
     203    {
     204        if (!RTListIsEmpty(&m_ListHead))
     205            return ConstIterator(RTListNodeGetPrevCpp(&m_ListHead, MapEntry, ListEntry));
     206        return end();
     207    }
    198208    /** Returns the end iterator.  This does not ever refer to an actual map entry. */
    199     inline ConstIterator end() const   { return ConstIterator(RT_FROM_CPP_MEMBER(&m_ListHead, MapEntry, ListEntry)); }
     209    inline ConstIterator end() const
     210    {
     211        return ConstIterator(RT_FROM_CPP_MEMBER(&m_ListHead, MapEntry, ListEntry));
     212    }
    200213    /** @} */
    201214
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