Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Slots | List of all members
DataPrinter Class Reference

Utility class for formatting and exporting byte data in various text formats. More...

#include <data_printer.h>

Inheritance diagram for DataPrinter:

Public Types

enum  DumpType {
  DP_HexDump , DP_HexOnly , DP_HexStream , DP_UTF8Text ,
  DP_ASCIIText , DP_CString , DP_GoLiteral , DP_CArray ,
  DP_MimeData , DP_Base64
}
 Enumeration of supported data dump formats. More...
 

Public Member Functions

 DataPrinter (QObject *parent=0)
 Constructs a new DataPrinter.
 
void toClipboard (DataPrinter::DumpType type, IDataPrintable *printable)
 Formats the printable data and copies it to the system clipboard.
 
void setByteLineLength (int bll)
 Sets the number of bytes displayed per line in formatted dumps.
 
int byteLineLength () const
 Retrieves the current number of bytes displayed per line.
 

Static Public Member Functions

static int separatorInterval ()
 Number of bytes after which to insert an extra separator space in a hex dump.
 
static int hexChars ()
 Calculates the total number of hexadecimal characters per line based on settings.
 
static QActionGroup * copyActions (QObject *copyClass, QObject *data=Q_NULLPTR)
 Generates a QActionGroup containing copy actions for all supported formats.
 
static DataPrinterinstance ()
 Retrieves the singleton instance of DataPrinter.
 

Protected Slots

void copyIDataBytes (bool)
 Slot triggered to copy bytes from a printable interface.
 

Detailed Description

Utility class for formatting and exporting byte data in various text formats.

Member Enumeration Documentation

◆ DumpType

Enumeration of supported data dump formats.

Enumerator
DP_HexDump 

Standard hex dump with ASCII representation.

DP_HexOnly 

Formatted hexadecimal characters only.

DP_HexStream 

Continuous stream of hexadecimal characters.

DP_UTF8Text 

UTF-8 encoded text.

DP_ASCIIText 

ASCII encoded text.

DP_CString 

C-style escaped string.

DP_GoLiteral 

Go language byte slice literal.

DP_CArray 

C-style byte array definition.

DP_MimeData 

Formatted MIME data.

DP_Base64 

Base64 encoded string.

Constructor & Destructor Documentation

◆ DataPrinter()

DataPrinter::DataPrinter ( QObject *  parent = 0)
explicit

Constructs a new DataPrinter.

Parameters
parentThe parent QObject, defaults to 0.

Member Function Documentation

◆ byteLineLength()

int DataPrinter::byteLineLength ( ) const

Retrieves the current number of bytes displayed per line.

Returns
The byte line length.

◆ copyActions()

QActionGroup * DataPrinter::copyActions ( QObject *  copyClass,
QObject *  data = Q_NULLPTR 
)
static

Generates a QActionGroup containing copy actions for all supported formats.

Parameters
copyClassThe parent object to own the actions.
dataOptional context data to associate with the actions, defaults to Q_NULLPTR.
Returns
A pointer to the created QActionGroup.

◆ hexChars()

int DataPrinter::hexChars ( )
static

Calculates the total number of hexadecimal characters per line based on settings.

Returns
The character count.

◆ instance()

DataPrinter * DataPrinter::instance ( )
static

Retrieves the singleton instance of DataPrinter.

Returns
Pointer to the global DataPrinter instance.

◆ separatorInterval()

static int DataPrinter::separatorInterval ( )
inlinestatic

Number of bytes after which to insert an extra separator space in a hex dump.

Returns
The separator interval (defaults to 8).

◆ setByteLineLength()

void DataPrinter::setByteLineLength ( int  bll)

Sets the number of bytes displayed per line in formatted dumps.

Parameters
bllThe byte length per line.

◆ toClipboard()

void DataPrinter::toClipboard ( DataPrinter::DumpType  type,
IDataPrintable printable 
)

Formats the printable data and copies it to the system clipboard.

Parameters
typeThe desired dump format.
printablePointer to the interface providing the data.

The documentation for this class was generated from the following files: