Declare some utilities to manipulate hexadecimal strings. More...
Namespaces | |
Qtl | |
Qtl namespace. | |
Enumerations | |
enum | Qtl::HexaFlag { Qtl::HexHexa = 0x0001, Qtl::HexAscii = 0x0002, Qtl::HexOffset = 0x0004, Qtl::HexWideOffset = 0x0008, Qtl::HexSingleLine = 0x0010, Qtl::HexBytesPerLine = 0x0020, Qtl::HexCStyle = 0x0040, Qtl::HexBinary = 0x0080, Qtl::HexBinNibble = 0x0100, Qtl::HexCompact = 0x0200 } |
Flags for the qtlHexa family of functions. More... | |
Functions | |
QString | qtlHexa (const void *data, int size, Qtl::HexaFlags flags=Qtl::HexaFlags(Qtl::HexHexa), int indent=0, int lineWidth=Qtl::DefautLineWidth, int initOffset=0) |
Build a multi-line string containing the hexadecimal dump of a memory area. More... | |
QString | qtlHexa (const QtlByteBlock &data, Qtl::HexaFlags flags=Qtl::HexaFlags(Qtl::HexHexa), int indent=0, int lineWidth=Qtl::DefautLineWidth, int initOffset=0) |
Build a multi-line string containing the hexadecimal dump of the content of a byte array. More... | |
bool | qtlHexaDecode (QtlByteBlock &result, const QString &hexaString) |
Interpret a string as a sequence of hexadecimal digits. More... | |
QtlByteBlock | qtlHexaDecode (const QString &hexaString) |
Interpret a string as a sequence of hexadecimal digits and return a QtlByteBlock. More... | |
bool | qtlHexaDecodeAndAppend (QtlByteBlock &result, const QString &hexaString) |
Interpret a string as a sequence of hexadecimal digits. More... | |
template<typename INT > | |
QString | qtlHexaInt (INT i, int width=0, int groupSize=0) |
Build an hexadecimal string from an integer value. More... | |
template<> | |
QString | qtlHexaInt (quint64 i, int width, int groupSize) |
Build an hexadecimal string from an integer value. More... | |
template<> | |
QString | qtlHexaInt (qint64 i, int width, int groupSize) |
Build an hexadecimal string from an integer value. More... | |
Variables | |
const int | Qtl::DefautLineWidth = 78 |
Default line width for output formatting. More... | |
Declare some utilities to manipulate hexadecimal strings.
Qtl, Qt utility library.
bool qtlHexaDecodeAndAppend | ( | QtlByteBlock & | result, |
const QString & | hexaString | ||
) |
Interpret a string as a sequence of hexadecimal digits.
Interpret all hexadecimal digits in hexaString. Each pair of hexadecimal digits is interpreted as one byte value which is appended into a byte array. Space characters are ignored. Other characters generate an error.
[in,out] | result | A byte array. All decoded bytes are appended to this container. |
[in] | hexaString | The string to decode. |
|
inline |
Interpret a string as a sequence of hexadecimal digits.
Interpret all hexadecimal digits in hexaString. Each pair of hexadecimal digits is interpreted as one byte value. A byte array is assigned with the result. Space characters are ignored. Other characters generate an error.
[out] | result | A byte array. All decoded bytes are stored into this vector. |
[in] | hexaString | The string to decode. |
|
inline |
Interpret a string as a sequence of hexadecimal digits and return a QtlByteBlock.
Interpret all hexadecimal digits in hexaString. Each pair of hexadecimal digits is interpreted as one byte value. A byte array is assigned with the result. Space characters are ignored. Other characters generate an error.
[in] | hexaString | The string to decode. |
|
inline |
Build an hexadecimal string from an integer value.
INT | An integer type. |
[in] | i | The integer value to format. |
[in] | width | The number of hexadecimal digits. If negative or zero, use the "natural" width for i. |
[in] | groupSize | The number of characters between spaces. If negative or zero, do not insert spaces. |
|
inline |
Build an hexadecimal string from an integer value.
Template specialization.
[in] | i | The integer value to format. |
[in] | width | The number of hexadecimal digits. If negative or zero, use the "natural" width for i. |
[in] | groupSize | The number of characters between spaces. If negative or zero, do not insert spaces. |
|
inline |
Build an hexadecimal string from an integer value.
Template specialization.
[in] | i | The integer value to format. |
[in] | width | The number of hexadecimal digits. If negative or zero, use the "natural" width for i. |
[in] | groupSize | The number of characters between spaces. If negative or zero, do not insert spaces. |
QString qtlHexa | ( | const void * | data, |
int | size, | ||
Qtl::HexaFlags | flags = Qtl::HexaFlags(Qtl::HexHexa) , |
||
int | indent = 0 , |
||
int | lineWidth = Qtl::DefautLineWidth , |
||
int | initOffset = 0 |
||
) |
Build a multi-line string containing the hexadecimal dump of a memory area.
[in] | data | Starting address of the memory area to dump. |
[in] | size | Size in bytes of the memory area to dump. |
[in] | flags | A combination of option flags indicating how to format the data. |
[in] | indent | Each line is indented by this number of characters. |
[in] | lineWidth | Maximum number of characters per line. If the flag HexBytesPerLine is specified, maxLineWidth is interpreted as the number of displayed byte values per line. |
[in] | initOffset | If the flag HexOffset is specified, an offset in the memory area is displayed at the beginning of each line. In this case, initOffset specified the offset value for the first byte. |
|
inline |
Build a multi-line string containing the hexadecimal dump of the content of a byte array.
[in] | data | The vector of bytes to dump. |
[in] | flags | A combination of option flags indicating how to format the data. |
[in] | indent | Each line is indented by this number of characters. |
[in] | lineWidth | Maximum number of characters per line. If the flag HexBytesPerLine is specified, maxLineWidth is interpreted as the number of displayed byte values per line. |
[in] | initOffset | If the flag HexOffset is specified, an offset in the memory area is displayed at the beginning of each line. In this case, initOffset specified the offset value for the first byte. |