VirtualBox

Changeset 79569 in vbox


Ignore:
Timestamp:
Jul 6, 2019 11:47:23 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131859
Message:

iprt/cpp/xml.h: Added more optimial helper for getting attributes of immediate children. bugref:9288

File:
1 edited

Legend:

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

    r76585 r79569  
    569569     *
    570570     * @returns Pointer to the child string value, NULL if not found or no value.
    571      * @param   pcszPath        The attribute name.  Slashes can be used to make a
    572      *                          simple path to any decendant.
     571     * @param   pcszPath        Path to the child element.  Slashes can be used to
     572     *                          make a simple path to any decendant.
    573573     * @param   pcszNamespace   The namespace to match, NULL (default) match any
    574574     *                          namespace.  When using a path, this matches all
     
    582582     *
    583583     * @returns Pointer to the child string value, NULL if not found or no value.
    584      * @param   pcszPath        The attribute name.  Slashes can be used to make a
    585      *                          simple path to any decendant.
     584     * @param   pcszPath        Path to the child element.  Slashes can be used to
     585     *                          make a simple path to any decendant.
    586586     * @param   pcszNamespace   The namespace to match, NULL (default) match any
    587587     *                          namespace.  When using a path, this matches all
     
    597597    }
    598598
    599     /** Combines findChildElementP and findAttributeValue.
     599    /** Combines findChildElementNS and findAttributeValue.
    600600     *
    601601     * @returns Pointer to attribute string value, NULL if either the element or
    602602     *          the attribute was not found.
    603      * @param   pcszPath            The attribute name.  Slashes can be used to make a
    604      *                              simple path to any decendant.
     603     * @param   pcszChild           The child element name.
     604     * @param   pcszAttribute       The attribute name.
     605     * @param   pcszChildNamespace  The namespace to match @a pcszChild with, NULL
     606     *                              (default) match any namespace.
     607     * @param   pcszAttributeNamespace  The namespace prefix to apply to the
     608     *                              attribute, NULL (default) match any namespace.
     609     * @see     findChildElementNS and findAttributeValue
     610     * @note    The findChildElementAttributeValueP() method would do the same thing
     611     *          given the same inputs, but it would be slightly slower, thus the
     612     *          separate method.
     613                                                                                    */
     614    const char *findChildElementAttributeValue(const char *pcszChild, const char *pcszAttribute,
     615                                               const char *pcszChildNamespace = NULL,
     616                                               const char *pcszAttributeNamespace = NULL) const
     617    {
     618        const ElementNode *pElem = findChildElementNS(pcszChildNamespace, pcszChild);
     619        if (pElem)
     620            return pElem->findAttributeValue(pcszAttribute, pcszAttributeNamespace);
     621        return NULL;
     622    }
     623
     624    /** Combines findChildElementP and findAttributeValue.
     625     *
     626     * @returns Pointer to attribute string value, NULL if either the element or
     627     *          the attribute was not found.
     628     * @param   pcszPath            Path to the child element.  Slashes can be used
     629     *                              to make a simple path to any decendant.
    605630     * @param   pcszAttribute       The attribute name.
    606631     * @param   pcszPathNamespace   The namespace to match @a pcszPath with, NULL
     
    749774    /** @} */
    750775
    751     /** @name Convenience findChildElementAttributeValueP and getElementValue.
     776    /** @name Convenience findChildElementValueP and getElementValue.
    752777     * @{ */
    753778    bool getChildElementValueP(const char *pcszPath, int32_t  *piValue, const char *pcszNamespace = NULL) const
     
    779804    /** @} */
    780805
    781     /** @name Convenience findChildElementAttributeValueP and getElementValue with a
     806    /** @name Convenience findChildElementValueP and getElementValue with a
    782807     *        default value being return if the child element isn't present.
    783808     *
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