ValueEnumeration¶
- class dsviper.ValueEnumeration¶
Bases:
ValueA value of type enum. Seamless with a Python str, or its ordinal as an int.
Or use Value.create(type_enumeration [, initial_value]). If the initial_value is not specified, the first enum case is used.
A case is written ‘a’, ‘.a’ or ‘NS::E.a’, where NS::E is the qualified name of the enum; any other string raises. The string representation of a case starts with a ‘.’.
- static cast(value: Value | _OutputValues) ValueEnumeration¶
Return value as an enum, or raise if it is not one.
- copy() ValueEnumeration¶
Return a deep copy.
- description(*, namespace: NameSpace | None = None) str¶
Return the value written out, then its type, as <value>:<type>.
namespace qualifies the type name; representation() gives the value alone.
- hash() int¶
Return the hash value.
- index() int¶
Return the ordinal of the case, in the order the enumeration declares them.
- name() str¶
Return the name of the enumeration case.
- representation() str¶
Return the value written out: the case name preceded by a dot, as .name.
- static try_parse(string: str, type_enumeration: TypeEnumeration) ValueEnumeration | None¶
Return string parsed as a case of type_enumeration, or None if it names none.
- type_code() str¶
Return the code naming this kind of value, such as “int32”, “struct” or “vector”.
- type_enumeration() TypeEnumeration¶
Return the type enum.