|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
Maps packet bytes to the character cells drawn in the text panel. More...
#include <byte_view_text_cells.h>
Classes | |
| struct | Cell |
| One displayed unit of text and the bytes it stands for. More... | |
Public Types | |
| enum | Encoding { Ascii , Ebcdic , Utf8 } |
| Character encoding of the data. More... | |
| enum | CellKind { Printable , NonPrintable , Invalid } |
| How a cell is displayed. More... | |
Public Member Functions | |
| void | decode (const QByteArray &data, Encoding encoding) |
Replace the cells with a decoding of data. | |
| void | clear () |
| Remove all cells. | |
| int | cellCount () const |
| Cell | cellAt (int cell_index) const |
Return the cell at cell_index. | |
| int | cellIndexForByte (int offset) const |
Return the index of the cell that contains offset. | |
| bool | cellForByte (int offset, Cell &cell) const |
Return the cell that contains offset. | |
Static Public Attributes | |
| static const int | max_cell_bytes = 32 |
| Longest run of bytes kept as a single cell. | |
Maps packet bytes to the character cells drawn in the text panel.
Every byte of the data belongs to exactly one cell. Single-byte encodings produce one cell per byte; those cells are computed on demand and take no memory. UTF-8 produces one cell per grapheme cluster, so combining marks, emoji modifier and ZWJ sequences, flags and keycap sequences stay together and their cell covers all of their bytes; those cells are decoded once and stored compactly.
Cells are listed in byte order. No bidirectional reordering or shaping is applied, so that the text panel keeps lining up with the hex panel.
| ByteViewTextCells::Cell ByteViewTextCells::cellAt | ( | int | cell_index | ) | const |
Return the cell at cell_index.
| cell_index | A cell index in [0, cellCount()). |
| int ByteViewTextCells::cellCount | ( | ) | const |
| bool ByteViewTextCells::cellForByte | ( | int | offset, |
| Cell & | cell ) const |
Return the cell that contains offset.
| offset | A byte offset. |
| cell | Receives the cell. |
offset is in range. | int ByteViewTextCells::cellIndexForByte | ( | int | offset | ) | const |
Return the index of the cell that contains offset.
| offset | A byte offset. |
offset is out of range. | void ByteViewTextCells::decode | ( | const QByteArray & | data, |
| Encoding | encoding ) |
Replace the cells with a decoding of data.
| data | The bytes to decode. |
| encoding | The character encoding to decode them with. |
|
static |
Longest run of bytes kept as a single cell.
Grapheme clusters longer than this are split into one cell per code point.