Freeciv-3.2: generate_packets.SizeInfo Class Reference

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 | receive_size_check (self, str field_name)
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 522 of file generate_packets.py.

## ◆ __hash__()

int generate_packets.SizeInfo.__hash__ | ( |  | self | ) |

Definition at line 528 of file generate_packets.py.

## ◆ __str__()

str generate_packets.SizeInfo.__str__ | ( |  | self | ) |

Definition at line 517 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.

## ◆ 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.

## ◆ receive_size_check()

str generate_packets.SizeInfo.receive_size_check | ( |  | 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.

## 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.