Freeciv-3.3
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes
generate_packets.ArrayType Class Reference
+ Inheritance diagram for generate_packets.ArrayType:

Public Member Functions

 __init__ (self, FieldType elem, SizeInfo size)
 
bool complex (self)
 
str get_code_declaration (self, Location location)
 
str get_code_param (self, Location location)
 
str get_code_init (self, Location location, str packet)
 
str get_code_copy (self, Location location, str dest, str src)
 
str get_code_fill (self, Location location, str packet)
 
str get_code_free (self, Location location, str packet)
 
str get_code_hash (self, Location location)
 
SizeInfo size_at (self, Location location)
 
str inner_cmp (self, Location location, str new, str old)
 
str inner_put (self, Location location, str packet, "str | None" diff_packet=None, int json_step=1)
 
str inner_get (self, Location location, str packet, bool deep_diff=False, int json_step=1)
 
str __str__ (self)
 
- Public Member Functions inherited from generate_packets.SequenceType
str resize (self, Location location, str packet, str new_size)
 
"Location | None" null_condition (self, Location location)
 
str get_code_cmp (self, Location location, str new, str old)
 
str get_code_put_full (self, Location location, str packet)
 
str get_code_put_diff (self, Location location, str packet, str diff_packet)
 
str get_code_put (self, Location location, str packet, "str | None" diff_packet=None)
 
str get_code_get_full (self, Location location, str packet)
 
str get_code_get_diff (self, Location location, str packet)
 
str get_code_get (self, Location location, str packet, bool deep_diff=False)
 
- Public Member Functions inherited from generate_packets.FieldType
"FieldType" array (self, SizeInfo size)
 
str get_code_handle_arg (self, Location location, str packet)
 
bool is_type_compatible (self, "FieldType" other)
 
- Public Member Functions inherited from generate_packets.RawFieldType
str __repr__ (self)
 

Data Fields

 elem
 
 size
 

Static Public Attributes

FieldType elem
 
SizeInfo size
 
- Static Public Attributes inherited from generate_packets.FieldType
bool foldable = False
 
- Static Public Attributes inherited from generate_packets.RawFieldType
str FieldTypeConstructor = typing.Callable[[str, str], RawFieldType]
 

Additional Inherited Members

- Protected Member Functions inherited from generate_packets.FieldType
 _compat_keys (self, Location location, str packet)
 

Detailed Description

Type information for an array field. Consists of size information and
another FieldType for the array's elements, which may also be an
ArrayType (for multi-dimensional arrays) or another SequenceType.

Definition at line 1765 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.ArrayType.__init__ (   self,
FieldType  elem,
SizeInfo  size 
)

Definition at line 1776 of file generate_packets.py.

Member Function Documentation

◆ __str__()

str generate_packets.ArrayType.__str__ (   self)

Reimplemented from generate_packets.RawFieldType.

Definition at line 1879 of file generate_packets.py.

◆ complex()

bool generate_packets.ArrayType.complex (   self)

Reimplemented from generate_packets.FieldType.

Definition at line 1781 of file generate_packets.py.

◆ get_code_copy()

str generate_packets.ArrayType.get_code_copy (   self,
Location  location,
str  dest,
str  src 
)
Generate a code snippet deep-copying a field of this type from
one packet struct to another that has already been initialized.

Subclasses must override this if self.complex is True

Reimplemented from generate_packets.FieldType.

Definition at line 1819 of file generate_packets.py.

◆ get_code_declaration()

str generate_packets.ArrayType.get_code_declaration (   self,
Location  location 
)
Generate a code snippet declaring a field with this type in a
packet struct.

Reimplemented from generate_packets.FieldType.

Definition at line 1784 of file generate_packets.py.

◆ get_code_fill()

str generate_packets.ArrayType.get_code_fill (   self,
Location  location,
str  packet 
)
Generate a code snippet shallow-copying a value of this type from
dsend arguments into a packet struct.

Reimplemented from generate_packets.FieldType.

Definition at line 1833 of file generate_packets.py.

◆ get_code_free()

str generate_packets.ArrayType.get_code_free (   self,
Location  location,
str  packet 
)
Generate a code snippet deinitializing a field of this type in
the packet struct before it gets destroyed.

Subclasses must override this if self.complex is True

Reimplemented from generate_packets.FieldType.

Definition at line 1845 of file generate_packets.py.

◆ get_code_hash()

str generate_packets.ArrayType.get_code_hash (   self,
Location  location 
)
Generate a code snippet factoring a field of this type into a
hash computation's `result`.

Reimplemented from generate_packets.FieldType.

Definition at line 1862 of file generate_packets.py.

◆ get_code_init()

str generate_packets.ArrayType.get_code_init (   self,
Location  location,
str  packet 
)
Generate a code snippet initializing a field of this type in the
packet struct, after the struct has already been zeroed.

Subclasses must override this if self.complex is True

Reimplemented from generate_packets.FieldType.

Definition at line 1802 of file generate_packets.py.

◆ get_code_param()

str generate_packets.ArrayType.get_code_param (   self,
Location  location 
)
Generate a code fragment declaring a parameter with this type for
a handle function.

See also self.get_code_handle_arg()

Reimplemented from generate_packets.FieldType.

Definition at line 1789 of file generate_packets.py.

◆ inner_cmp()

str generate_packets.ArrayType.inner_cmp (   self,
Location  location,
str  new,
str  old 
)
Generate the loop body for get_code_cmp()

This is placed at the very beginning of a scope, so variable
declarations are permitted without requiring an extra block.

Reimplemented from generate_packets.SequenceType.

Definition at line 1868 of file generate_packets.py.

◆ inner_get()

str generate_packets.ArrayType.inner_get (   self,
Location  location,
str  packet,
bool   deep_diff = False,
int   json_step = 1 
)
Generate the main part of the loop body for get_code_get()

Reimplemented from generate_packets.SequenceType.

Definition at line 1875 of file generate_packets.py.

◆ inner_put()

str generate_packets.ArrayType.inner_put (   self,
Location  location,
str  packet,
"str | None"   diff_packet = None,
int   json_step = 1 
)
Generate the main part of the loop body for get_code_put()

Reimplemented from generate_packets.SequenceType.

Definition at line 1871 of file generate_packets.py.

◆ size_at()

SizeInfo generate_packets.ArrayType.size_at (   self,
Location  location 
)
Return a size info object for a field of this type

Reimplemented from generate_packets.SequenceType.

Definition at line 1865 of file generate_packets.py.

Field Documentation

◆ elem [1/2]

FieldType generate_packets.ArrayType.elem
static

Definition at line 1770 of file generate_packets.py.

◆ elem [2/2]

generate_packets.ArrayType.elem

Definition at line 1777 of file generate_packets.py.

◆ size [1/2]

SizeInfo generate_packets.ArrayType.size
static

Definition at line 1773 of file generate_packets.py.

◆ size [2/2]

generate_packets.ArrayType.size

Definition at line 1778 of file generate_packets.py.