56 line
1.5 KiB
C
56 line
1.5 KiB
C
#ifndef cmTextTemplate_h
|
|
#define cmTextTemplate_h
|
|
|
|
|
|
enum
|
|
{
|
|
kOkTtRC = cmOkRC,
|
|
kFileFailTtRC,
|
|
kLHeapFailTtRC,
|
|
kSyntaxErrTtRC,
|
|
kFindFailTtRC,
|
|
kInvalidTypeTtRC,
|
|
kJsonFailTtRC
|
|
};
|
|
|
|
typedef cmHandle_t cmTtH_t;
|
|
typedef unsigned cmTtRC_t;
|
|
extern cmTtH_t cmTtNullHandle;
|
|
|
|
// Initialize a template file.
|
|
cmTtRC_t cmTextTemplateInitialize( cmCtx_t* ctx, cmTtH_t* hp, const cmChar_t* fn );
|
|
|
|
// Finalize a template file
|
|
cmTtRC_t cmTextTemplateFinalize( cmTtH_t* hp );
|
|
|
|
// Return true if the template file is intialized.
|
|
bool cmTextTemplateIsValid( cmTtH_t h );
|
|
|
|
// Set the value of a template variable.
|
|
// The node identified by { label,index, label, index ... } must
|
|
// be a variable node. The function will fail if a 'set' or 'text' node
|
|
// is identified.
|
|
// Set 'value' to NULL to erase a previously set value.
|
|
cmTtRC_t cmTextTemplateSetValue( cmTtH_t h, const cmChar_t* value, const cmChar_t* label, unsigned index, ... );
|
|
|
|
// Create a copy of the sub-tree identified by the variable path
|
|
// and insert it as the left sibling of the sub-tree's root.
|
|
cmTtRC_t cmTextTemplateRepeat( cmTtH_t h, const cmChar_t* label, unsigned index, ... );
|
|
|
|
// Write the template file.
|
|
cmTtRC_t cmTextTemplateWrite( cmTtH_t h, const cmChar_t* fn );
|
|
|
|
// Apply a template value JSON file to this template
|
|
cmTtRC_t cmTextTemplateApply( cmTtH_t h, const cmChar_t* fn );
|
|
|
|
|
|
// Print an annotated template tree.
|
|
void cmTtPrintTree( cmTtH_t h, cmRpt_t* rpt );
|
|
|
|
|
|
cmTtRC_t cmTextTemplateTest( cmCtx_t* ctx, const cmChar_t* fn );
|
|
|
|
|
|
|
|
#endif
|