tpm_varlist

Land Desktop Development ARX CPP SDK

Up a level
tpm_varlist
 
 

Gets all the values in a set of configuration variables.

struct resbuf

*tpm_varlist(

ade_id var_id);

Returns a resbuf of name-value pairs or NULL.

var_id Configuration variables ID.

Configuration variables are composed of cleanup variables, cleanup action variables, and topology variables. The variables are initialized to their default values. For a list of these variables and their default values, see Configuration Variables.

The calling function must release the resbuf.

Each resbuf has this format:

variable name, (RTSTR) . value, (RTSTR, RTREAL, RTSHORT)

The following sample allocates a set of configuration variables using tpm_varalloc(), then populates a resbuf with name-value pairs associated with the current configuration variable set using tpm_varlist(). The contents of the resbuf are displayed, then the resbuf is released as required.

ade_id varId = tpm_varalloc();
struct resbuf* pConfigVarsRb = tpm_varlist(varId);
if (NULL != pConfigVarsRb){
    struct resbuf* rb = pConfigVarsRb;
    while(NULL != rb) {
        if (rb->restype == RTSTR) {
            acutPrintf(
                   "\nThe \"%s\" property contained the value:"
                    , rb->resval.rstring);
            if (NULL != (rb = rb->rbnext)) {
                switch(rb->restype)
                {
                    case RTSTR:
                        acutPrintf(
                            " \"%s\""
                            , rb->resval.rstring);
                        break;
                    case RTREAL:
                        acutPrintf(
                            " %.2lf"
                            , rb->resval.rreal);
                        break;
                    case RTSHORT:
                        acutPrintf(
                            " %d"
                            , rb->resval.rint);
                        break;
                    default:
                        break;
                }
            }
        }
        rb = rb->rbnext;
    }
}
else {
    acutPrintf(
        "\nThe configuration variable list could not been retrieved.");
}
acutRelRb(pConfigVarsRb);