HDK
|
#include "UT_API.h"
Go to the source code of this file.
Typedefs | |
typedef const char *(* | UTVarCallback )(const char *str, void *userdata) |
Functions | |
UT_API int | UTVariableScan (UT_WorkBuffer &outstr, const char *instr, UTVarCallback lookup, void *userdata, bool tildeexpand=true, bool commentsexpand=true, bool rawstringexpand=true) |
UT_API int | UTExprVariableScan (UT_WorkBuffer &outstr, const char *instr, UTVarCallback lookup, UTVarCallback expreval, void *userdata, bool varexpand=true, bool tildeexpand=true, bool commentsexpand=true, bool rawstringexpand=true) |
typedef const char*(* UTVarCallback)(const char *str, void *userdata) |
Definition at line 20 of file UT_VarScan.h.
UT_API int UTExprVariableScan | ( | UT_WorkBuffer & | outstr, |
const char * | instr, | ||
UTVarCallback | lookup, | ||
UTVarCallback | expreval, | ||
void * | userdata, | ||
bool | varexpand = true , |
||
bool | tildeexpand = true , |
||
bool | commentsexpand = true , |
||
bool | rawstringexpand = true |
||
) |
UTExprVariableScan writes the output to a fixed length char * buffer in outstr of size n. The number of variables that were expanded is returned.
UT_API int UTVariableScan | ( | UT_WorkBuffer & | outstr, |
const char * | instr, | ||
UTVarCallback | lookup, | ||
void * | userdata, | ||
bool | tildeexpand = true , |
||
bool | commentsexpand = true , |
||
bool | rawstringexpand = true |
||
) |
UTVariableScan copies the input string instr to the work string outstr searching for variable references of the form $name or ${name} in the input string. Each such variable reference found in the input string is replaced by its value which is obtained by passing the variable name to the func- tion referenced by the given argument lookup. If the given function fails by returning a null pointer then the variable reference is replaced in the output string by a null string.
If a null function pointer is passed as the lookup argument, then UTVariableScan calls the function getenv to find the value of each variable.
UTVariableScan returns the integer number of variables which have been expanded.
commentsexpand allows expanding inside C and C++ style comments. WARNING: It can currently be fooled by them showing up in strings!
rawstringexpand allows expanding inside r"" and r'' style raw strings.