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

Public Member Functions

 __init__ (self, str dataio_type, str public_type, SizeInfo size)
 
str get_code_declaration (self, Location location)
 
str get_code_param (self, Location location)
 
str get_code_fill (self, Location location, str packet)
 
str get_code_copy (self, Location location, str dest, str src)
 
str __str__ (self)
 
- Public Member Functions inherited from generate_packets.BasicType
str get_code_hash (self, Location location, str packet)
 
str get_code_cmp (self, Location location, str new, str old)
 
str get_code_put (self, Location location, str packet, "str | None" diff_packet=None)
 
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)
 
str get_code_init (self, Location location, str packet)
 
str get_code_free (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

 size
 
- Data Fields inherited from generate_packets.BasicType
 dataio_type
 
 public_type
 

Static Public Attributes

SizeInfo size
 
- Static Public Attributes inherited from generate_packets.BasicType
str dataio_type
 
str public_type
 
str DEFAULT_REGISTRY = TypeRegistry(BasicType)
 
- Static Public Attributes inherited from generate_packets.FieldType
bool foldable = False
 
bool complex = 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

Abstract base class (ABC) for field types that include a size

Definition at line 1226 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.SizedType.__init__ (   self,
str  dataio_type,
str  public_type,
SizeInfo  size 
)

Reimplemented from generate_packets.BasicType.

Reimplemented in generate_packets.StringType, and generate_packets.MemoryType.

Definition at line 1232 of file generate_packets.py.

Member Function Documentation

◆ __str__()

str generate_packets.SizedType.__str__ (   self)

Reimplemented from generate_packets.BasicType.

Definition at line 1256 of file generate_packets.py.

◆ get_code_copy()

str generate_packets.SizedType.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.

Reimplemented in generate_packets.StringType, and generate_packets.MemoryType.

Definition at line 1253 of file generate_packets.py.

◆ get_code_declaration()

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

Reimplemented from generate_packets.BasicType.

Definition at line 1236 of file generate_packets.py.

◆ get_code_fill()

str generate_packets.SizedType.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.

Reimplemented in generate_packets.StringType, and generate_packets.MemoryType.

Definition at line 1249 of file generate_packets.py.

◆ get_code_param()

str generate_packets.SizedType.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.BasicType.

Definition at line 1241 of file generate_packets.py.

Field Documentation

◆ size [1/2]

SizeInfo generate_packets.SizedType.size
static

Definition at line 1229 of file generate_packets.py.

◆ size [2/2]

generate_packets.SizedType.size

Definition at line 1234 of file generate_packets.py.