libcm is a C development framework with an emphasis on audio signal processing applications.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

cmXml.h 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. cmXmlRC_t cmXmlTest( cmCtx_t* ctx, const cmChar_t* fn );
  72. #ifdef __cpluspus
  73. }
  74. #endif
  75. #endif