libcm is a C development framework with an emphasis on audio signal processing applications.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cmXml.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef cmXml_h
  2. #define cmXml_h
  3. #ifdef __cpluspus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkXmlRC = cmOkRC,
  9. kMemAllocErrXmlRC,
  10. kLHeapXmlRC,
  11. kSyntaxErrorXmlRC,
  12. kTestFailXmlRC,
  13. kInvalidTypeXmlRC,
  14. kNodeNotFoundXmlRC
  15. };
  16. typedef struct cmXmlAttr_str
  17. {
  18. const cmChar_t* label;
  19. const cmChar_t* value;
  20. struct cmXmlAttr_str* link;
  21. } cmXmlAttr_t;
  22. enum
  23. {
  24. kRootXmlFl = 0x0001,
  25. kDeclXmlFl = 0x0002,
  26. kDoctypeXmlFl = 0x0004,
  27. kNormalXmlFl = 0x0008,
  28. kTypeXmlFlags = kRootXmlFl | kDeclXmlFl | kDoctypeXmlFl | kNormalXmlFl,
  29. kClosedXmlFl = 0x0010
  30. };
  31. typedef struct cmXmlNode_str
  32. {
  33. unsigned flags; // See k???XmlFl
  34. const cmChar_t* label; // node label
  35. const cmChar_t* dataStr; // node data string
  36. cmXmlAttr_t* attr; // attribute list
  37. struct cmXmlNode_str* parent; // parent node
  38. struct cmXmlNode_str* children; // first child node list
  39. struct cmXmlNode_str* sibling; //
  40. } cmXmlNode_t;
  41. typedef cmHandle_t cmXmlH_t;
  42. typedef cmRC_t cmXmlRC_t;
  43. extern cmXmlH_t cmXmlNullHandle;
  44. cmXmlRC_t cmXmlAlloc( cmCtx_t* ctx, cmXmlH_t* hh, const cmChar_t* fn );
  45. cmXmlRC_t cmXmlFree( cmXmlH_t* hh );
  46. bool cmXmlIsValid( cmXmlH_t h );
  47. cmXmlRC_t cmXmlParse( cmXmlH_t h, const cmChar_t* fn );
  48. cmXmlRC_t cmXmlClear( cmXmlH_t h );
  49. const cmXmlNode_t* cmXmlRoot( cmXmlH_t h );
  50. void cmXmlPrint( cmXmlH_t h, cmRpt_t* rpt );
  51. const cmXmlNode_t* cmXmlSearch( const cmXmlNode_t* np, const cmChar_t* label, const cmXmlAttr_t* attrV, unsigned attrN );
  52. const cmXmlAttr_t* cmXmlFindAttrib( const cmXmlNode_t* np, const cmChar_t* label );
  53. cmXmlRC_t cmXmlAttrInt( const cmXmlNode_t* np, const cmChar_t* attrLabel, int* retRef );
  54. cmXmlRC_t cmXmlAttrUInt( const cmXmlNode_t* np, const cmChar_t* attrLabel, unsigned* retRef );
  55. // Return the data value for a node or attributes.
  56. // List Syntax: node-label-0, node-label-1, NULL, attr-label-0 attr-label-1
  57. const cmChar_t* cmXmlNodeValueV( const cmXmlNode_t* np, va_list vl );
  58. const cmChar_t* cmXmlNodeValue( const cmXmlNode_t* np, ... );
  59. cmXmlRC_t cmXmlNodeIntV( const cmXmlNode_t* np, int* retRef, va_list vl );
  60. cmXmlRC_t cmXmlNodeUIntV(const cmXmlNode_t* np, unsigned* retRef, va_list vl );
  61. cmXmlRC_t cmXmlNodeInt( const cmXmlNode_t* np, int* retRef, ... );
  62. cmXmlRC_t cmXmlNodeUInt( const cmXmlNode_t* np, unsigned* retRef, ... );
  63. cmXmlRC_t cmXmlTest( cmCtx_t* ctx, const cmChar_t* fn );
  64. #ifdef __cpluspus
  65. }
  66. #endif
  67. #endif