#include <hex_dump.h>
Classes | |
struct | Flags |
Public Types | |
enum | AddressMode { kDisabled = 0 , kOffset = 1 , kAbsolute = 2 } |
Public Member Functions | |
FormattedHexDumper (span< char > dest) | |
FormattedHexDumper (span< char > dest, Flags config_flags) | |
Status | SetLineBuffer (span< char > dest) |
Status | BeginDump (ConstByteSpan data) |
Status | DumpLine () |
Public Attributes | |
Flags | flags |
The formatted hex dumper is a configurable class that can dump hex in various formats. The default produced output is xxd compatible, though there are options to further adjust the output. One example is address prefixing, where base memory address of each line is used instead of an offset.
It is strongly recommended NOT to directly depend on this dump format; pw_hex_dump does NOT guarantee stability for the output format, but strives to remain xxd compatible.
Default:
Example 1: (32-bit machine, group_every=4, prefix_mode=kAbsolute, bytes_per_line = 8)
Example 2: (group_every=1, bytes_per_line = 16)
Example 3: (group_every=0, prefix_mode=kNone, show_header=false, show_ascii=false)
Status pw::dump::FormattedHexDumper::BeginDump | ( | ConstByteSpan | data | ) |
Begin dumping the provided data. Does NOT populate the line buffer with a string, simply resets the statefulness to track this buffer.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: Ready to begin dump. * * INVALID_ARGUMENT: The source data starts at null, but has been set. * * FAILED_PRECONDITION: Line buffer too small to hold current formatting * settings. * *
Status pw::dump::FormattedHexDumper::DumpLine | ( | ) |
Dumps a single line to the line buffer.
Example usage:
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: A line has been written to the line buffer. * * RESOURCE_EXHAUSTED: All the data has been dumped. * * FAILED_PRECONDITION: Destination line buffer is too small to fit * current formatting configuration. * *
Status pw::dump::FormattedHexDumper::SetLineBuffer | ( | span< char > | dest | ) |
Set the destination buffer that the hex dumper will write to line-by-line.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * RESOURCE_EXHAUSTED: The buffer was set, but is too small to fit the * current formatting configuration. * * INVALID_ARGUMENT: The destination buffer is invalid (nullptr or zero- * length). * *
Flags pw::dump::FormattedHexDumper::flags |