# eric6.HexEdit.HexEditUndoStack

Module implementing the Undo stack for the hex edit widget.

### Global Attributes

None

### Classes

HexEditCommand | Class implementing the edit comands.
HexEditUndoCommand | Class implementing the Undo command.
HexEditUndoStack | Class implementing an Undo stack for the hex edit widget.

### Functions

None

## HexEditCommand

Class implementing the edit comands.

### Derived from

Enum

### Class Attributes

Insert
Overwrite
RemoveAt

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## HexEditUndoCommand

Class implementing the Undo command.

### Derived from

QUndoCommand

### Class Attributes

None

### Class Methods

None

### Methods

HexEditUndoCommand | Constructor
id | Public method to get the ID of this undo command class.
mergeWith | Public method to merge this command with another one.
redo | Public method to redo the command.
undo | Public method to undo the command.

### Static Methods

None

#### HexEditUndoCommand (Constructor)

HexEditUndoCommand(chunks, cmd, pos, newByte, parent=None)

Constructor

chunks (HexEditChunks)
  reference to the data container
cmd (HexEditCommand)
  edit command
pos (int)
  edit position
newByte (int (range 0 to 255))
  new byte value
parent (QUndoCommand)
  reference to the parent command

#### HexEditUndoCommand.id

id()

Public method to get the ID of this undo command class.

Returns:
  ID of the undo command class

Return Type:
  int

#### HexEditUndoCommand.mergeWith

mergeWith(command)

Public method to merge this command with another one.

command (QUndoCommand)
  reference to the command to merge with

Returns:
  flag indicating a successful merge

Return Type:
  bool

#### HexEditUndoCommand.redo

redo()

Public method to redo the command.

#### HexEditUndoCommand.undo

undo()

Public method to undo the command.

Up

## HexEditUndoStack

Class implementing an Undo stack for the hex edit widget.

### Derived from

QUndoStack

### Class Attributes

None

### Class Methods

None

### Methods

HexEditUndoStack | Constructor
insert | Public method to insert a byte.
insertByteArray | Public method to insert bytes.
overwrite | Public method to replace a byte.
overwriteByteArray | Public method to replace bytes.
removeAt | Public method to remove bytes.

### Static Methods

None

#### HexEditUndoStack (Constructor)

HexEditUndoStack(chunks, parent=None)

Constructor

chunks (HexEditChunks)
  reference to the data container
parent (QObject)
  reference to the parent object

#### HexEditUndoStack.insert

insert(pos, data)

Public method to insert a byte.

pos (int)
  position to insert at
data (int (range 0 to 255))
  byte to be inserted

#### HexEditUndoStack.insertByteArray

insertByteArray(pos, byteArray)

Public method to insert bytes.

pos (int)
  position to insert at
byteArray (byteArray or QByteArray)
  data to be inserted

#### HexEditUndoStack.overwrite

overwrite(pos, data)

Public method to replace a byte.

pos (int)
  position to replace the byte at
data (int (range 0 to 255))
  byte to replace with

#### HexEditUndoStack.overwriteByteArray

overwriteByteArray(pos, length, byteArray)

Public method to replace bytes.

pos (int)
  position to replace the bytes at
length (int)
  amount of bytes to replace
byteArray (bytearray or QByteArray)
  bytes to replace with

#### HexEditUndoStack.removeAt

removeAt(pos, length=1)

Public method to remove bytes.

pos (int)
  position to remove bytes from
length (int)
  amount of bytes to remove

Up