class EnumerationField(Field):
+ """
+ Enumeration field, based on an
+ :class:`EnumerationFieldDeclaration` object.
+ """
+
@property
def container(self):
"""
- Return the enumeration's underlying container field (an integer field).
+ Underlying container (:class:`IntegerField`).
+
+ :exc:`TypeError` is raised on error.
"""
container = IntegerField.__new__(IntegerField)
@property
def value(self):
"""
- Get the enumeration field's mapping name.
+ Current label of this enumeration field (:class:`str`).
+
+ Set this attribute to an integer (:class:`int`) to change the
+ enumeration field's value.
+
+ :exc:`ValueError` is raised on error.
"""
value = nbt._bt_ctf_field_enumeration_get_mapping_name(self._f)
if value is None:
- raise ValueError("Could not get enumeration's mapping name.")
+ raise ValueError("Could not get enumeration mapping name.")
return value
@value.setter
def value(self, value):
- """
- Set the enumeration field's value. Must be an integer as mapping names
- may be ambiguous.
- """
-
if not isinstance(value, int):
raise TypeError("EnumerationField value must be an int")