libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmTextTemplate.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef cmTextTemplate_h
  2. #define cmTextTemplate_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //( { file_desc:"Generate text using templates with replaceable variables." kw:[text] }
  7. enum
  8. {
  9. kOkTtRC = cmOkRC,
  10. kFileFailTtRC,
  11. kLHeapFailTtRC,
  12. kSyntaxErrTtRC,
  13. kFindFailTtRC,
  14. kInvalidTypeTtRC,
  15. kJsonFailTtRC
  16. };
  17. typedef cmHandle_t cmTtH_t;
  18. typedef unsigned cmTtRC_t;
  19. extern cmTtH_t cmTtNullHandle;
  20. // Initialize a template file.
  21. cmTtRC_t cmTextTemplateInitialize( cmCtx_t* ctx, cmTtH_t* hp, const cmChar_t* fn );
  22. // Finalize a template file
  23. cmTtRC_t cmTextTemplateFinalize( cmTtH_t* hp );
  24. // Return true if the template file is intialized.
  25. bool cmTextTemplateIsValid( cmTtH_t h );
  26. // Set the value of a template variable.
  27. // The node identified by { label,index, label, index ... } must
  28. // be a variable node. The function will fail if a 'set' or 'text' node
  29. // is identified.
  30. // Set 'value' to NULL to erase a previously set value.
  31. cmTtRC_t cmTextTemplateSetValue( cmTtH_t h, const cmChar_t* value, const cmChar_t* label, unsigned index, ... );
  32. // Create a copy of the sub-tree identified by the variable path
  33. // and insert it as the left sibling of the sub-tree's root.
  34. cmTtRC_t cmTextTemplateRepeat( cmTtH_t h, const cmChar_t* label, unsigned index, ... );
  35. // Write the template file.
  36. cmTtRC_t cmTextTemplateWrite( cmTtH_t h, const cmChar_t* fn );
  37. // Apply a template value JSON file to this template
  38. cmTtRC_t cmTextTemplateApply( cmTtH_t h, const cmChar_t* fn );
  39. // Print an annotated template tree.
  40. void cmTtPrintTree( cmTtH_t h, cmRpt_t* rpt );
  41. cmTtRC_t cmTextTemplateTest( cmCtx_t* ctx, const cmChar_t* fn );
  42. //)
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif