Freeciv-3.2
|
Public Member Functions | |
"typing.Iterable[Field]" | parse (cls, ScriptConfig cfg, str line, typing.Callable[[str], RawFieldType] resolve_type) |
__init__ (self, ScriptConfig cfg, str name, FieldType type_info, FieldFlags flags) | |
bool | is_key (self) |
bool | diff (self) |
"typing.AbstractSet[str]" | all_caps (self) |
bool | is_compatible (self, "Field" other) |
bool | present_with_caps (self, typing.Container[str] caps) |
str | get_declar (self) |
str | get_handle_param (self) |
str | get_handle_arg (self, str packet_arrow) |
str | get_fill (self) |
str | get_hash (self) |
str | get_cmp (self) |
bool | folded_into_head (self) |
str | get_cmp_wrapper (self, int i, "Variant" pack) |
str | get_put_wrapper (self, "Variant" packet, int i, bool deltafragment) |
str | get_put (self, bool deltafragment) |
str | get_put_real (self, bool deltafragment) |
str | get_get_wrapper (self, "Variant" packet, int i, bool deltafragment) |
str | get_get (self, bool deltafragment) |
str | get_get_real (self, bool deltafragment) |
Data Fields | |
cfg | |
name | |
type_info | |
flags | |
diff | |
Static Public Attributes | |
FIELDS_LINE_PATTERN = re.compile(r"^\s*(\w+(?:\([^()]*\))?)\s+([^;()]*?)\s*;\s*(.*?)\s*$") | |
FIELD_ARRAY_PATTERN = re.compile(r"^(.+)\[([^][]+)\]$") | |
A single field of a packet. Consists of a name, type information (including array sizes) and flags.
Definition at line 1454 of file generate_packets.py.
generate_packets.Field.__init__ | ( | self, | |
ScriptConfig | cfg, | ||
str | name, | ||
FieldType | type_info, | ||
FieldFlags | flags | ||
) |
Definition at line 1500 of file generate_packets.py.
"typing.AbstractSet[str]" generate_packets.Field.all_caps | ( | self | ) |
Set of all capabilities affecting this field
Definition at line 1523 of file generate_packets.py.
bool generate_packets.Field.diff | ( | self | ) |
Whether this field uses deep diff / array-diff when transmitted as part of a delta packet
Definition at line 1517 of file generate_packets.py.
bool generate_packets.Field.folded_into_head | ( | self | ) |
Whether this field is folded into the packet header. If enabled, lone booleans (which only carry one bit of information) get directly written into the `fields` bitvector, since they don't take any more space than the usual "content-differs" bit would. See also get_cmp_wrapper()
Definition at line 1590 of file generate_packets.py.
str generate_packets.Field.get_cmp | ( | self | ) |
Generate code checking whether this field changed. This code is primarily used by self.get_cmp_wrapper()
Definition at line 1583 of file generate_packets.py.
Generate code setting this field's bit in the `fields` bitvector. This bit marks whether the field changed and is being transmitted, except for (non-array) boolean fields folded into the header; see self.folded_into_head for more details. See also self.get_cmp()
Definition at line 1603 of file generate_packets.py.
str generate_packets.Field.get_declar | ( | self | ) |
Generate the way this field is declared in the packet struct
Definition at line 1552 of file generate_packets.py.
str generate_packets.Field.get_fill | ( | self | ) |
Generate code moving this field from the dsend arguments into the packet struct.
Definition at line 1573 of file generate_packets.py.
Generate the code getting this field, i.e. reading it from the dataio stream. This does not include delta-related code checking if the field was transmitted in the first place; see self.get_get_wrapper()
Definition at line 1732 of file generate_packets.py.
Generate the bare core of this field's get code. This code is not yet wrapped for full delta and JSON protocol support. See self.get_get() for more info
Definition at line 1744 of file generate_packets.py.
Generate code conditionally getting this field iff its bit in the `fields` bitvector is set. For boolean fields folded into the packet header, instead reads the field from the bitvector. See also self.get_get()
Definition at line 1706 of file generate_packets.py.
Generate the way this field is passed as an argument to a handle function. See also self.get_handle_param()
Definition at line 1563 of file generate_packets.py.
str generate_packets.Field.get_handle_param | ( | self | ) |
Generate the way this field is declared as a parameter of a handle function. See also self.get_handle_arg()
Definition at line 1556 of file generate_packets.py.
str generate_packets.Field.get_hash | ( | self | ) |
Generate code factoring this field into a hash computation.
Definition at line 1578 of file generate_packets.py.
Generate the code putting this field, i.e. writing it to the dataio stream. This does not include delta-related code checking whether to transmit the field in the first place; see self.get_put_wrapper()
Definition at line 1681 of file generate_packets.py.
Generate the bare core of this field's put code. This code is not yet wrapped for full delta and JSON protocol support. See self.get_put() for more info
Definition at line 1699 of file generate_packets.py.
Generate code conditionally putting this field iff its bit in the `fields` bitvector is set. Does nothing for boolean fields folded into the packet header. See also self.get_put()
Definition at line 1649 of file generate_packets.py.
bool generate_packets.Field.is_compatible | ( | self, | |
"Field" | other | ||
) |
Whether two field objects are variants of the same field, i.e. type-compatible in the packet struct and mutually exclusive based on their required capabilities. Note that this function does not test field name.
Definition at line 1527 of file generate_packets.py.
bool generate_packets.Field.is_key | ( | self | ) |
Whether this is a key field
Definition at line 1512 of file generate_packets.py.
"typing.Iterable[Field]" generate_packets.Field.parse | ( | cls, | |
ScriptConfig | cfg, | ||
str | line, | ||
typing.Callable[[str], RawFieldType] | resolve_type | ||
) |
Parse a single line defining one or more fields
Definition at line 1474 of file generate_packets.py.
Determine whether this field should be part of a variant with the given capabilities
Definition at line 1543 of file generate_packets.py.
generate_packets.Field.cfg |
Definition at line 1501 of file generate_packets.py.
generate_packets.Field.diff |
Definition at line 1704 of file generate_packets.py.
|
static |
Definition at line 1466 of file generate_packets.py.
|
static |
Definition at line 1458 of file generate_packets.py.
generate_packets.Field.flags |
Definition at line 1508 of file generate_packets.py.
generate_packets.Field.name |
Definition at line 1503 of file generate_packets.py.
generate_packets.Field.type_info |
Definition at line 1506 of file generate_packets.py.