Charset
Charset(size, empty, enable_pairs=False)
Character set.
| PARAMETER | DESCRIPTION |
|---|---|
size
|
number of characters in character set
TYPE:
|
empty
|
byte sequence representing an empty character
TYPE:
|
enable_pairs
|
whether to enable adding character pairs
TYPE:
|
character_count
property
Number of used characters.
max_index
property
Maximum used character index.
add(value)
Add character at next free index.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
byte sequence representing character to add
TYPE:
|
Returns: index of added character Raises: OverflowError: If no more characters are available.
add_pair(value1, value2, offset=None)
Add character pair at next free index pair.
| PARAMETER | DESCRIPTION |
|---|---|
value1
|
byte sequence representing first character to add
TYPE:
|
value2
|
byte sequence representing second character to add
TYPE:
|
offset
|
offset between first and second character indices
TYPE:
|
Returns: index of first added character Raises: OverflowError: If no pair of characters is available. RuntimeError: If enable_pairs is False.
add_with_index(value, index)
Add character at given index.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
byte sequence representing character to add
TYPE:
|
index
|
index at which to add character
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If character at given index is already set |
get_bytes(full=False)
Get character set as bytes.
| PARAMETER | DESCRIPTION |
|---|---|
full
|
whether to include all characters or only up to the last used one
TYPE:
|
Returns: bytes representing the character set
get_value(index)
Get character at given index.
| PARAMETER | DESCRIPTION |
|---|---|
index
|
index of character to get
TYPE:
|
Returns: byte sequence representing character at given index