libcm is a C development framework with an emphasis on audio signal processing applications.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

cmXml.h 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 line; // line number
  34. unsigned flags; // See k???XmlFl
  35. const cmChar_t* label; // node label
  36. const cmChar_t* dataStr; // node data string
  37. cmXmlAttr_t* attr; // attribute list
  38. struct cmXmlNode_str* parent; // parent node
  39. struct cmXmlNode_str* children; // first child node list
  40. struct cmXmlNode_str* sibling; //
  41. } cmXmlNode_t;
  42. typedef cmHandle_t cmXmlH_t;
  43. typedef cmRC_t cmXmlRC_t;
  44. extern cmXmlH_t cmXmlNullHandle;
  45. cmXmlRC_t cmXmlAlloc( cmCtx_t* ctx, cmXmlH_t* hh, const cmChar_t* fn );
  46. cmXmlRC_t cmXmlFree( cmXmlH_t* hh );
  47. bool cmXmlIsValid( cmXmlH_t h );
  48. cmXmlRC_t cmXmlParse( cmXmlH_t h, const cmChar_t* fn );
  49. cmXmlRC_t cmXmlClear( cmXmlH_t h );
  50. const cmXmlNode_t* cmXmlRoot( cmXmlH_t h );
  51. void cmXmlPrint( cmXmlH_t h, cmRpt_t* rpt );
  52. const cmXmlNode_t* cmXmlSearch( const cmXmlNode_t* np, const cmChar_t* label, const cmXmlAttr_t* attrV, unsigned attrN );
  53. const cmXmlAttr_t* cmXmlFindAttrib( const cmXmlNode_t* np, const cmChar_t* label );
  54. cmXmlRC_t cmXmlAttrInt( const cmXmlNode_t* np, const cmChar_t* attrLabel, int* retRef );
  55. cmXmlRC_t cmXmlAttrUInt( const cmXmlNode_t* np, const cmChar_t* attrLabel, unsigned* retRef );
  56. // Return the data value for a node or attributes.
  57. // Terminate node label list with NULL.
  58. const cmChar_t* cmXmlNodeValueV( const cmXmlNode_t* np, va_list vl );
  59. const cmChar_t* cmXmlNodeValue( const cmXmlNode_t* np, ... );
  60. // Terminate node label list with NULL.
  61. cmXmlRC_t cmXmlNodeIntV( const cmXmlNode_t* np, int* retRef, va_list vl );
  62. cmXmlRC_t cmXmlNodeUIntV( const cmXmlNode_t* np, unsigned* retRef, va_list vl );
  63. cmXmlRC_t cmXmlNodeDoubleV( const cmXmlNode_t* np, double* retRef, va_list vl );
  64. // Terminate node label list with NULL.
  65. cmXmlRC_t cmXmlNodeInt( const cmXmlNode_t* np, int* retRef, ... );
  66. cmXmlRC_t cmXmlNodeUInt( const cmXmlNode_t* np, unsigned* retRef, ... );
  67. cmXmlRC_t cmXmlNodeDouble(const cmXmlNode_t* np, double* retRef, ... );
  68. // Terminate node label list with NULL.
  69. bool cmXmlNodeHasChildV(const cmXmlNode_t* np, const cmChar_t* label, va_list vl );
  70. bool cmXmlNodeHasChild( const cmXmlNode_t* np, const cmChar_t* label, ... );
  71. // Last label in list is an attribute label.
  72. // Terminate the list with NULL.
  73. bool cmXmlNodeHasChildWithAttrV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl );
  74. bool cmXmlNodeHasChildWithAttr( const cmXmlNode_t* np, const cmChar_t* label, ... );
  75. // Last second to last label in the list is an attribute label.
  76. // THe last label in the list is an attribute value.
  77. // Terminate the list with NULL.
  78. bool cmXmlNodeHasChildWithAttrAndValueV( const cmXmlNode_t* np, const cmChar_t* label, va_list vl );
  79. bool cmXmlNodeHasChildWithAttrAndValue( const cmXmlNode_t* np, const cmChar_t* label, ... );
  80. cmXmlRC_t cmXmlTest( cmCtx_t* ctx, const cmChar_t* fn );
  81. #ifdef __cpluspus
  82. }
  83. #endif
  84. #endif