Freeciv-3.3
|
Data Fields | |
cfg | |
name | |
type_info | |
flags | |
diff | |
Static Public Attributes | |
FIELDS_LINE_PATTERN = re.compile(, re.VERBOSE) | |
FIELD_ARRAY_PATTERN = re.compile(r"^(.+)\[([^][]+)\]$") | |
dict | FORBIDDEN_NAMES = {"pid", "fields"} |
ScriptConfig | cfg |
str | name |
FieldType | type_info |
FieldFlags | flags |
A single field of a packet. Consists of a name, type information (including array sizes) and flags.
Definition at line 2090 of file generate_packets.py.
generate_packets.Field.__init__ | ( | self, | |
ScriptConfig | cfg, | ||
str | name, | ||
FieldType | type_info, | ||
FieldFlags | flags | ||
) |
Definition at line 2172 of file generate_packets.py.
"typing.AbstractSet[str]" generate_packets.Field.all_caps | ( | self | ) |
Set of all capabilities affecting this field
Definition at line 2190 of file generate_packets.py.
bool generate_packets.Field.complex | ( | self | ) |
Whether this field's type requires special handling; see FieldType.complex
Definition at line 2195 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 2184 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 2268 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 2317 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 2281 of file generate_packets.py.
Generate code deep-copying this field from *src to *dest.
Definition at line 2248 of file generate_packets.py.
str generate_packets.Field.get_declaration | ( | self | ) |
Generate the way this field is declared in the packet struct
Definition at line 2225 of file generate_packets.py.
str generate_packets.Field.get_fill | ( | self | ) |
Generate code shallow-copying this field from the dsend arguments into the packet struct.
Definition at line 2252 of file generate_packets.py.
str generate_packets.Field.get_free | ( | self | ) |
Generate code deinitializing this field in the packet struct before destroying the packet.
Definition at line 2257 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 2407 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 2421 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 2381 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 2236 of file generate_packets.py.
str generate_packets.Field.get_hash | ( | self | ) |
Generate code factoring this field into a hash computation.
Definition at line 2262 of file generate_packets.py.
str generate_packets.Field.get_init | ( | self | ) |
Generate code initializing this field in the packet struct, after the struct has already been zeroed.
Definition at line 2243 of file generate_packets.py.
str generate_packets.Field.get_param | ( | self | ) |
Generate the way this field is declared as a parameter of a handle or dsend function. See also self.get_handle_arg()
Definition at line 2229 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 2355 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 2374 of file generate_packets.py.
str generate_packets.Field.get_put_wrapper | ( | self, | |
"Variant" | packet, | ||
int | index, | ||
bool | deltafragment | ||
) |
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 2323 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 2200 of file generate_packets.py.
bool generate_packets.Field.is_key | ( | self | ) |
Whether this is a key field
Definition at line 2179 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 2143 of file generate_packets.py.
Determine whether this field should be part of a variant with the given capabilities
Definition at line 2216 of file generate_packets.py.
|
static |
Definition at line 2130 of file generate_packets.py.
generate_packets.Field.cfg |
Definition at line 2173 of file generate_packets.py.
generate_packets.Field.diff |
Definition at line 2426 of file generate_packets.py.
|
static |
Definition at line 2119 of file generate_packets.py.
|
static |
Definition at line 2094 of file generate_packets.py.
|
static |
Definition at line 2139 of file generate_packets.py.
generate_packets.Field.flags |
Definition at line 2176 of file generate_packets.py.
|
static |
Definition at line 2126 of file generate_packets.py.
|
static |
Definition at line 2133 of file generate_packets.py.
generate_packets.Field.name |
Definition at line 2174 of file generate_packets.py.
|
static |
Definition at line 2136 of file generate_packets.py.
generate_packets.Field.type_info |
Definition at line 2175 of file generate_packets.py.