NAME

cgGetStateEnumerant - get a state enumerant name and value by index

SYNOPSIS

  #include <Cg/cg.h>

  const char * cgGetStateEnumerant( CGstate state, int index, int * value );

PARAMETERS

state

The state from which to retrieve an enumerant name and value.

index

The index for the enumerant in state.

value

Pointer to integer where the enumerant value will be stored.

RETURN VALUES

Returns the NULL-terminated enumerant name string associated with state at position index. The enumerant value is returned via the value parameter.

Returns NULL if an error occurs. value will be 0.

DESCRIPTION

cgGetStateEnumerant allows the application to retrieve the enumerant name and value associated with a CGstate at a specified index location. The number of enumerants assocated with a state can be discovered using cgGetNumStateEnumerants.

EXAMPLES

    int value;
    char* pName;

    int nEnums = cgGetNumStateEnumerants(state);

    for (ii=0; ii<nEnums; ++ii) {
        pName = cgGetStateEnumerant(state, ii, &value );
        printf("%i: %s %i\n", ii+1, pName, value);
    }

ERRORS

CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.

CG_INVALID_POINTER_ERROR is generated if value is NULL.

CG_INVALID_PARAMETER_ERROR is generated if index is less than 0 or index is greater than or equal to the number of enumerants associated with state.

HISTORY

cgGetStateEnumerant was introduced in Cg 2.2.

SEE ALSO

cgAddStateEnumerant, cgGetNumStateEnumerants, cgGetStateEnumerantName, cgGetStateEnumerantValue