libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmXml.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 cmXmlNodeDoubleV( const cmXmlNode_t* np, double* retRef, va_list vl );
  62. cmXmlRC_t cmXmlNodeInt( const cmXmlNode_t* np, int* retRef, ... );
  63. cmXmlRC_t cmXmlNodeUInt( const cmXmlNode_t* np, unsigned* retRef, ... );
  64. cmXmlRC_t cmXmlNodeDouble(const cmXmlNode_t* np, double* retRef, ...);
  65. bool cmXmlNodeHasChild( const cmXmlNode_t* np, const cmChar_t* label );
  66. cmXmlRC_t cmXmlTest( cmCtx_t* ctx, const cmChar_t* fn );
  67. #ifdef __cpluspus
  68. }
  69. #endif
  70. #endif