Changeset 79677 in vbox for trunk/include
- Timestamp:
- Jul 10, 2019 3:45:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/xml.h
r79569 r79677 58 58 typedef struct _xmlNode xmlNode; 59 59 60 #define RT_XML_CONTENT_SMALL _8K 61 #define RT_XML_CONTENT_LARGE _128K 62 #define RT_XML_ATTR_TINY 64 63 #define RT_XML_ATTR_SMALL _1K 64 #define RT_XML_ATTR_MEDIUM _8K 65 #define RT_XML_ATTR_LARGE _64K 66 60 67 /** @} */ 61 68 … … 253 260 * Opens a file with the given name in the given mode. If @a aMode is Read 254 261 * or ReadWrite, the file must exist. If @a aMode is Write, the file must 255 * not exist. Otherwise, an EIPRTFailure exce tion will be thrown.262 * not exist. Otherwise, an EIPRTFailure exception will be thrown. 256 263 * 257 264 * @param aMode File mode. … … 410 417 411 418 const char *getValue() const; 419 const char *getValueN(size_t cchValueLimit) const; 412 420 bool copyValue(int32_t &i) const; 413 421 bool copyValue(uint32_t &i) const; … … 594 602 if (pElem) 595 603 return pElem->getValue(); 604 return NULL; 605 } 606 607 /** Finds the first child with matching the give name and optionally namspace, 608 * returning its value. Checks the length against the limit. 609 * 610 * @returns Pointer to the child string value, NULL if not found or no value. 611 * @param pcszPath Path to the child element. Slashes can be used to 612 * make a simple path to any decendant. 613 * @param cchValueLimit If the length of the returned value exceeds this 614 * limit a EIPRTFailure exception will be thrown. 615 * @param pcszNamespace The namespace to match, NULL (default) match any 616 * namespace. When using a path, this matches all 617 * elements along the way. 618 * @see findChildElement, findChildElementP 619 */ 620 const char *findChildElementValuePN(const char *pcszPath, size_t cchValueLimit, const char *pcszNamespace = NULL) const 621 { 622 const ElementNode *pElem = findChildElementP(pcszPath, pcszNamespace); 623 if (pElem) 624 return pElem->getValueN(cchValueLimit); 596 625 return NULL; 597 626 } … … 646 675 } 647 676 677 /** Combines findChildElementP and findAttributeValueN. 678 * 679 * @returns Pointer to attribute string value, NULL if either the element or 680 * the attribute was not found. 681 * @param pcszPath The attribute name. Slashes can be used to make a 682 * simple path to any decendant. 683 * @param pcszAttribute The attribute name. 684 * @param cchValueLimit If the length of the returned value exceeds this 685 * limit a EIPRTFailure exception will be thrown. 686 * @param pcszPathNamespace The namespace to match @a pcszPath with, NULL 687 * (default) match any namespace. When using a 688 * path, this matches all elements along the way. 689 * @param pcszAttributeNamespace The namespace prefix to apply to the 690 * attribute, NULL (default) match any namespace. 691 * @see findChildElementP and findAttributeValue 692 */ 693 const char *findChildElementAttributeValuePN(const char *pcszPath, const char *pcszAttribute, 694 size_t cchValueLimit, 695 const char *pcszPathNamespace = NULL, 696 const char *pcszAttributeNamespace = NULL) const 697 { 698 const ElementNode *pElem = findChildElementP(pcszPath, pcszPathNamespace); 699 if (pElem) 700 return pElem->findAttributeValueN(pcszAttribute, cchValueLimit, pcszAttributeNamespace); 701 return NULL; 702 } 703 648 704 649 705 /** @name Tree enumeration. … … 733 789 if (pAttr) 734 790 return pAttr->getValue(); 791 return NULL; 792 } 793 /** Find the first attribute with the given name, returning its value string. 794 * @returns Pointer to the attribute string value. 795 * @param pcszName The attribute name. 796 * @param cchValueLimit If the length of the returned value exceeds this 797 * limit a EIPRTFailure exception will be thrown. 798 * @param pcszNamespace The namespace name, default is NULL which means 799 * anything goes. 800 * @see getAttributeValue 801 */ 802 const char *findAttributeValueN(const char *pcszName, size_t cchValueLimit, const char *pcszNamespace = NULL) const 803 { 804 const AttributeNode *pAttr = findAttribute(pcszName, pcszNamespace); 805 if (pAttr) 806 return pAttr->getValueN(cchValueLimit); 735 807 return NULL; 736 808 } … … 752 824 bool getAttributeValue(const char *pcszMatch, bool &f, const char *pcszNamespace = NULL) const 753 825 { return getAttributeValue(pcszMatch, &f, pcszNamespace); } 826 bool getAttributeValueN(const char *pcszMatch, const char *&pcsz, size_t cchValueLimit, const char *pcszNamespace = NULL) const 827 { return getAttributeValueN(pcszMatch, &pcsz, cchValueLimit, pcszNamespace); } 828 bool getAttributeValueN(const char *pcszMatch, RTCString &str, size_t cchValueLimit, const char *pcszNamespace = NULL) const 829 { return getAttributeValueN(pcszMatch, &str, cchValueLimit, pcszNamespace); } 830 bool getAttributeValuePathN(const char *pcszMatch, RTCString &str, size_t cchValueLimit, const char *pcszNamespace = NULL) const 831 { return getAttributeValueN(pcszMatch, &str, cchValueLimit, pcszNamespace); } 754 832 755 833 /** @name Variants that for clarity does not use references for output params. … … 763 841 bool getAttributeValue(const char *pcszMatch, uint64_t *pu, const char *pcszNamespace = NULL) const; 764 842 bool getAttributeValue(const char *pcszMatch, bool *pf, const char *pcszNamespace = NULL) const; 843 bool getAttributeValueN(const char *pcszMatch, const char **ppcsz, size_t cchValueLimit, const char *pcszNamespace = NULL) const; 844 bool getAttributeValueN(const char *pcszMatch, RTCString *pStr, size_t cchValueLimit, const char *pcszNamespace = NULL) const; 845 bool getAttributeValuePathN(const char *pcszMatch, RTCString *pStr, size_t cchValueLimit, const char *pcszNamespace = NULL) const; 765 846 /** @} */ 766 847
Note:
See TracChangeset
for help on using the changeset viewer.