SILICON
Loading...
Searching...
No Matches
BinaryEditor Class Reference

#include <binaryEditor.hpp>

Inheritance diagram for BinaryEditor:
Collaboration diagram for BinaryEditor:

Classes

struct  Inspector

Public Member Functions

 BinaryEditor (QWidget *parent=nullptr)
 ~BinaryEditor () override
void setData (QByteArray data)
const QByteArray & data () const noexcept
bool setByteOffset (std::size_t offset)
bool canReadValue (std::size_t bitWidth) const
std::optional< std::uint64_t > readValue (std::size_t bitWidth) const
bool overwriteValue (std::uint64_t value, std::size_t bitWidth, const QString &undoText={})
bool overwriteHexDigit (unsigned digit)
QUndoStack * history () const noexcept
bool isModified () const
void setModified (bool modified)
void refreshInspectors ()
void zoomBy (int steps)
 Adjusts the hexadecimal view's text size by the given number of points.

Private Member Functions

unsigned nibbleAt (std::size_t offset) const
void applyNibbles (std::size_t offset, const std::vector< unsigned > &values)
void pushNibbleEdit (std::size_t offset, std::vector< unsigned > values, const QString &text)
void commitInspector (Inspector &inspector)
void commitOffset ()
void refreshOffset ()
void updateEditorState ()

Private Attributes

QByteArray bytes
std::size_t selectedByte = 0
bool highHexDigitEntered = false
BinaryHexView * hexView
QLineEdit * offsetEdit
std::vector< Inspector > inspectors
std::unique_ptr< BinaryUndoStack > undoHistory
CallbackScope callbacks

Friends

class BinaryHexView
class BinaryNibbleEditCommand

Detailed Description

Fixed-size binary document editor with a byte-oriented hexadecimal caret.

Definition at line 41 of file binaryEditor.hpp.

Constructor & Destructor Documentation

◆ BinaryEditor()

BinaryEditor ( QWidget * parent = nullptr)
explicit

Definition at line 363 of file binaryEditor.cpp.

◆ ~BinaryEditor()

~BinaryEditor ( )
overridedefault

Member Function Documentation

◆ applyNibbles()

void applyNibbles ( std::size_t offset,
const std::vector< unsigned > & values )
private

Definition at line 556 of file binaryEditor.cpp.

◆ canReadValue()

bool canReadValue ( std::size_t bitWidth) const
nodiscard

Definition at line 478 of file binaryEditor.cpp.

◆ commitInspector()

void commitInspector ( Inspector & inspector)
private

Definition at line 585 of file binaryEditor.cpp.

◆ commitOffset()

void commitOffset ( )
private

Definition at line 620 of file binaryEditor.cpp.

◆ data()

const QByteArray & data ( ) const
nodiscardnoexcept

Definition at line 461 of file binaryEditor.cpp.

◆ history()

QUndoStack * history ( ) const
nodiscardnoexcept

Definition at line 533 of file binaryEditor.cpp.

◆ isModified()

bool isModified ( ) const
nodiscard

Definition at line 538 of file binaryEditor.cpp.

◆ nibbleAt()

unsigned nibbleAt ( std::size_t offset) const
nodiscardprivate

Definition at line 549 of file binaryEditor.cpp.

◆ overwriteHexDigit()

bool overwriteHexDigit ( unsigned digit)

Definition at line 516 of file binaryEditor.cpp.

◆ overwriteValue()

bool overwriteValue ( std::uint64_t value,
std::size_t bitWidth,
const QString & undoText = {} )

Definition at line 498 of file binaryEditor.cpp.

◆ pushNibbleEdit()

void pushNibbleEdit ( std::size_t offset,
std::vector< unsigned > values,
const QString & text )
private

Definition at line 572 of file binaryEditor.cpp.

◆ readValue()

std::optional< std::uint64_t > readValue ( std::size_t bitWidth) const
nodiscard

Definition at line 484 of file binaryEditor.cpp.

◆ refreshInspectors()

void refreshInspectors ( )

Definition at line 603 of file binaryEditor.cpp.

◆ refreshOffset()

void refreshOffset ( )
private

Definition at line 643 of file binaryEditor.cpp.

◆ setByteOffset()

bool setByteOffset ( std::size_t offset)

Definition at line 466 of file binaryEditor.cpp.

◆ setData()

void setData ( QByteArray data)

Definition at line 450 of file binaryEditor.cpp.

◆ setModified()

void setModified ( bool modified)

Definition at line 543 of file binaryEditor.cpp.

◆ updateEditorState()

void updateEditorState ( )
private

Definition at line 656 of file binaryEditor.cpp.

◆ zoomBy()

void zoomBy ( int steps)

Adjusts the hexadecimal view's text size by the given number of points.

Definition at line 441 of file binaryEditor.cpp.

◆ BinaryHexView

friend class BinaryHexView
friend

Definition at line 66 of file binaryEditor.hpp.

◆ BinaryNibbleEditCommand

friend class BinaryNibbleEditCommand
friend

Definition at line 67 of file binaryEditor.hpp.

Member Data Documentation

◆ bytes

QByteArray bytes
private

Definition at line 84 of file binaryEditor.hpp.

◆ callbacks

CallbackScope callbacks
private

Definition at line 91 of file binaryEditor.hpp.

◆ hexView

BinaryHexView* hexView
private

Definition at line 87 of file binaryEditor.hpp.

◆ highHexDigitEntered

bool highHexDigitEntered = false
private

Definition at line 86 of file binaryEditor.hpp.

◆ inspectors

std::vector<Inspector> inspectors
private

Definition at line 89 of file binaryEditor.hpp.

◆ offsetEdit

QLineEdit* offsetEdit
private

Definition at line 88 of file binaryEditor.hpp.

◆ selectedByte

std::size_t selectedByte = 0
private

Definition at line 85 of file binaryEditor.hpp.

◆ undoHistory

std::unique_ptr<BinaryUndoStack> undoHistory
private

Definition at line 90 of file binaryEditor.hpp.


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