DCSwitch

from panda3d.direct import DCSwitch
class DCSwitch

Bases:

Bases: DCDeclaration

This represents a switch statement, which can appear inside a class body and represents two or more alternative unpacking schemes based on the first field read.

Inheritance diagram

Inheritance diagram of DCSwitch

getCase(n: int) DCPackerInterface

Returns the DCPackerInterface that packs the nth case.

getCaseByValue(case_value: bytes) int

Returns the index number of the case with the indicated packed value, or -1 if no case has this value.

getDefaultCase() DCPackerInterface

Returns the DCPackerInterface that packs the default case, or NULL if there is no default case.

getField(case_index: int, n: int) DCField

Returns the nth field in the indicated case.

getFieldByName(case_index: int, name: str) DCField

Returns the field with the given name from the indicated case, or NULL if no field has this name.

getKeyParameter() DCField

Returns the key parameter on which the switch is based. The value of this parameter in the record determines which one of the several cases within the switch will be used.

getName() str

Returns the name of this switch.

getNumCases() int

Returns the number of different cases within the switch. The legal values for case_index range from 0 to getNumCases() - 1.

getNumFields(case_index: int) int

Returns the number of fields in the indicated case.

getValue(case_index: int) bytes

Returns the packed value associated with the indicated case.