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.9KB

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