DCSwitch¶
from panda3d.direct import DCSwitch
-
class
DCSwitch
¶ 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
-
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.
-
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.
-
getNumCases
() → int¶ Returns the number of different cases within the switch. The legal values for case_index range from 0 to
getNumCases()
- 1.
-