summaryrefslogtreecommitdiff
path: root/externals/qhexedit/commands.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--externals/qhexedit/commands.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/externals/qhexedit/commands.h b/externals/qhexedit/commands.h
deleted file mode 100644
index 9931b3fb5..000000000
--- a/externals/qhexedit/commands.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef COMMANDS_H
2#define COMMANDS_H
3
4/** \cond docNever */
5
6#include <QUndoCommand>
7
8#include "xbytearray.h"
9
10/*! CharCommand is a class to prived undo/redo functionality in QHexEdit.
11A QUndoCommand represents a single editing action on a document. CharCommand
12is responsable for manipulations on single chars. It can insert. replace and
13remove characters. A manipulation stores allways to actions
141. redo (or do) action
152. undo action.
16
17CharCommand also supports command compression via mergeWidht(). This allows
18the user to execute a undo command contation e.g. 3 steps in a single command.
19If you for example insert a new byt "34" this means for the editor doing 3
20steps: insert a "00", replace it with "03" and the replace it with "34". These
213 steps are combined into a single step, insert a "34".
22*/
23class CharCommand : public QUndoCommand
24{
25public:
26 enum { Id = 1234 };
27 enum Cmd {insert, remove, replace};
28
29 CharCommand(XByteArray * xData, Cmd cmd, int charPos, char newChar,
30 QUndoCommand *parent=0);
31
32 void undo();
33 void redo();
34 bool mergeWith(const QUndoCommand *command);
35 int id() const { return Id; }
36
37private:
38 XByteArray * _xData;
39 int _charPos;
40 bool _wasChanged;
41 char _newChar;
42 char _oldChar;
43 Cmd _cmd;
44};
45
46/*! ArrayCommand provides undo/redo functionality for handling binary strings. It
47can undo/redo insert, replace and remove binary strins (QByteArrays).
48*/
49class ArrayCommand : public QUndoCommand
50{
51public:
52 enum Cmd {insert, remove, replace};
53 ArrayCommand(XByteArray * xData, Cmd cmd, int baPos, QByteArray newBa=QByteArray(), int len=0,
54 QUndoCommand *parent=0);
55 void undo();
56 void redo();
57
58private:
59 Cmd _cmd;
60 XByteArray * _xData;
61 int _baPos;
62 int _len;
63 QByteArray _wasChanged;
64 QByteArray _newBa;
65 QByteArray _oldBa;
66};
67
68/** \endcond docNever */
69
70#endif // COMMANDS_H