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

Public Member Functions

 __init__ (self, str dataio_type, str public_type)
 
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_fill (self, Location location, str packet)
 
str get_code_copy (self, Location location, str dest, str src)
 
str get_code_free (self, Location location, str packet)
 
str get_code_hash (self, Location location)
 
str get_code_cmp (self, Location location, str new, str old)
 
str resize (self, Location location, str packet, str new_size)
 
Location null_condition (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 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)
 

Static Public Member Functions

SizeInfo size_at (Location location)
 

Data Fields

 dataio_type
 
 public_type
 

Static Public Attributes

str dataio_type
 
str public_type
 
bool complex = True
 
- 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

Type information for a string vector field

Definition at line 1945 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.StrvecType.__init__ (   self,
str  dataio_type,
str  public_type 
)

Definition at line 1956 of file generate_packets.py.

Member Function Documentation

◆ __str__()

str generate_packets.StrvecType.__str__ (   self)

Reimplemented from generate_packets.RawFieldType.

Definition at line 2071 of file generate_packets.py.

◆ get_code_cmp()

str generate_packets.StrvecType.get_code_cmp (   self,
Location  location,
str  new,
str  old 
)
Generate a code snippet comparing a field of this type between
the given packets and setting `differ` accordingly. The `old`
packet is one we know to have been initialized by our own code.

Reimplemented from generate_packets.SequenceType.

Definition at line 2017 of file generate_packets.py.

◆ get_code_copy()

str generate_packets.StrvecType.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 1995 of file generate_packets.py.

◆ get_code_declaration()

str generate_packets.StrvecType.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 1966 of file generate_packets.py.

◆ get_code_fill()

str generate_packets.StrvecType.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 1986 of file generate_packets.py.

◆ get_code_free()

str generate_packets.StrvecType.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 2006 of file generate_packets.py.

◆ get_code_hash()

str generate_packets.StrvecType.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 2014 of file generate_packets.py.

◆ get_code_init()

str generate_packets.StrvecType.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 1980 of file generate_packets.py.

◆ get_code_param()

str generate_packets.StrvecType.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 1971 of file generate_packets.py.

◆ inner_cmp()

str generate_packets.StrvecType.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 2040 of file generate_packets.py.

◆ inner_get()

str generate_packets.StrvecType.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 2058 of file generate_packets.py.

◆ inner_put()

str generate_packets.StrvecType.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 2048 of file generate_packets.py.

◆ null_condition()

Location generate_packets.StrvecType.null_condition (   self,
Location  location 
)
Return a code condition that if TRUE means the field cannot be used
normally and should be treated as empty, or None if this never happens

Reimplemented from generate_packets.SequenceType.

Definition at line 2037 of file generate_packets.py.

◆ resize()

str generate_packets.StrvecType.resize (   self,
Location  location,
str  packet,
str  new_size 
)
Return a code snippet updating the size of a field of this type,
or the empty string if this type doesn't need to individually transmit
and update its size

Reimplemented from generate_packets.SequenceType.

Definition at line 2032 of file generate_packets.py.

◆ size_at()

SizeInfo generate_packets.StrvecType.size_at ( Location  self)
static
Return a size info object for a field of this type

Reimplemented from generate_packets.SequenceType.

Definition at line 2029 of file generate_packets.py.

Field Documentation

◆ complex

bool generate_packets.StrvecType.complex = True
static

Definition at line 1954 of file generate_packets.py.

◆ dataio_type [1/2]

str generate_packets.StrvecType.dataio_type
static

Definition at line 1948 of file generate_packets.py.

◆ dataio_type [2/2]

generate_packets.StrvecType.dataio_type

Definition at line 1963 of file generate_packets.py.

◆ public_type [1/2]

str generate_packets.StrvecType.public_type
static

Definition at line 1951 of file generate_packets.py.

◆ public_type [2/2]

generate_packets.StrvecType.public_type

Definition at line 1964 of file generate_packets.py.