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

get_case(n: int) DCPackerInterface

Returns the DCPackerInterface that packs the nth case.

get_case_by_value(case_value: bytes) int

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

get_default_case() DCPackerInterface

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

get_field(case_index: int, n: int) DCField

Returns the nth field in the indicated case.

get_field_by_name(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.

get_key_parameter() 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.

get_name() str

Returns the name of this switch.

get_num_cases() int

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

get_num_fields(case_index: int) int

Returns the number of fields in the indicated case.

get_value(case_index: int) bytes

Returns the packed value associated with the indicated case.