Freeciv-3.2
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes | Protected Attributes
generate_packets.SizeInfo Class Reference

Public Member Functions

"SizeInfo" parse (cls, size_text)
 
 __init__ (self, str declared, "str | None" actual)
 
bool constant (self)
 
str actual_for (self, str packet)
 
str real (self)
 
str old (self)
 
str size_check_get (self, str field_name)
 
str size_check_index (self, str field_name)
 
str index_put (self, str index)
 
str index_get (self, Location location)
 
str __str__ (self)
 
bool __eq__ (self, other)
 
int __hash__ (self)
 

Data Fields

 declared
 

Static Public Attributes

 ARRAY_SIZE_PATTERN = re.compile(r"^([^:]+)(?:\:([^:]+))?$")
 

Protected Attributes

 _actual
 

Detailed Description

Information about size along one dimension of an array or other sized
field type. Contains both the declared / maximum size, and the actual
used size (if different).

Definition at line 454 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.SizeInfo.__init__ (   self,
str  declared,
"str | None"  actual 
)

Definition at line 475 of file generate_packets.py.

Member Function Documentation

◆ __eq__()

bool generate_packets.SizeInfo.__eq__ (   self,
  other 
)

Definition at line 576 of file generate_packets.py.

◆ __hash__()

int generate_packets.SizeInfo.__hash__ (   self)

Definition at line 582 of file generate_packets.py.

◆ __str__()

str generate_packets.SizeInfo.__str__ (   self)

Definition at line 571 of file generate_packets.py.

◆ actual_for()

str generate_packets.SizeInfo.actual_for (   self,
str  packet 
)
Return a code expression representing the actual size for the
given packet

Definition at line 487 of file generate_packets.py.

◆ constant()

bool generate_packets.SizeInfo.constant (   self)
Whether the actual size doesn't change

Definition at line 483 of file generate_packets.py.

◆ index_get()

str generate_packets.SizeInfo.index_get (   self,
Location  location 
)
Generate a code snippet reading the next index from the
network input decoded as the correct type

Definition at line 549 of file generate_packets.py.

◆ index_put()

str generate_packets.SizeInfo.index_put (   self,
str  index 
)
Generate a code snippet writing the given value to the network
output, encoded as the appropriate index type

Definition at line 529 of file generate_packets.py.

◆ old()

str generate_packets.SizeInfo.old (   self)
The number of elements transmitted last time. Either the same as
the declared size, or a field of `*old`.

Definition at line 501 of file generate_packets.py.

◆ parse()

"SizeInfo" generate_packets.SizeInfo.parse (   cls,
  size_text 
)
Parse the given array size text (without brackets)

Definition at line 468 of file generate_packets.py.

◆ real()

str generate_packets.SizeInfo.real (   self)
The number of elements to transmit. Either the same as the
declared size, or a field of `*real_packet`.

Definition at line 495 of file generate_packets.py.

◆ size_check_get()

str generate_packets.SizeInfo.size_check_get (   self,
str  field_name 
)
Generate a code snippet checking whether the received size is in
range when receiving a packet.

Definition at line 506 of file generate_packets.py.

◆ size_check_index()

str generate_packets.SizeInfo.size_check_index (   self,
str  field_name 
)
Generate a code snippet asserting that indices can be correctly
transmitted for array-diff.

Definition at line 517 of file generate_packets.py.

Field Documentation

◆ _actual

generate_packets.SizeInfo._actual
protected

Definition at line 478 of file generate_packets.py.

◆ ARRAY_SIZE_PATTERN

generate_packets.SizeInfo.ARRAY_SIZE_PATTERN = re.compile(r"^([^:]+)(?:\:([^:]+))?$")
static

Definition at line 459 of file generate_packets.py.

◆ declared

generate_packets.SizeInfo.declared

Definition at line 476 of file generate_packets.py.