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

Public Member Functions

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

Data Fields

 declared
 
 actual
 

Static Public Attributes

 ARRAY_SIZE_PATTERN = re.compile(r"^([^:]+)(?:\:([^:]+))?$")
 
Location declared
 
Location 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 517 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 544 of file generate_packets.py.

Member Function Documentation

◆ __eq__()

bool generate_packets.SizeInfo.__eq__ (   self,
  other 
)

Definition at line 634 of file generate_packets.py.

◆ __hash__()

int generate_packets.SizeInfo.__hash__ (   self)

Definition at line 642 of file generate_packets.py.

◆ __str__()

str generate_packets.SizeInfo.__str__ (   self)

Definition at line 625 of file generate_packets.py.

◆ constant()

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

Definition at line 554 of file generate_packets.py.

◆ index_get()

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

Definition at line 603 of file generate_packets.py.

◆ index_put()

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

Definition at line 583 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 537 of file generate_packets.py.

◆ size_check_get()

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

Definition at line 560 of file generate_packets.py.

◆ size_check_index()

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

Definition at line 571 of file generate_packets.py.

Field Documentation

◆ actual [1/2]

Location generate_packets.SizeInfo.actual
static

Definition at line 532 of file generate_packets.py.

◆ actual [2/2]

generate_packets.SizeInfo.actual

Definition at line 547 of file generate_packets.py.

◆ ARRAY_SIZE_PATTERN

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

Definition at line 522 of file generate_packets.py.

◆ declared [1/2]

Location generate_packets.SizeInfo.declared
static

Definition at line 529 of file generate_packets.py.

◆ declared [2/2]

generate_packets.SizeInfo.declared

Definition at line 545 of file generate_packets.py.