diff options
author | ShizZy <shizzy@6bit.net> | 2013-08-30 05:35:09 +0200 |
---|---|---|
committer | ShizZy <shizzy@6bit.net> | 2013-08-30 05:35:09 +0200 |
commit | 27474060e1287a67c45cd790d29b9095b35b2bdf (patch) | |
tree | fcbc56f1182617c01597f13e1a18dbec147d4216 /externals/qhexedit/xbytearray.h | |
parent | Initial commit (diff) | |
download | yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar.gz yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar.bz2 yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar.lz yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar.xz yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.tar.zst yuzu-27474060e1287a67c45cd790d29b9095b35b2bdf.zip |
Diffstat (limited to '')
-rw-r--r-- | externals/qhexedit/xbytearray.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/externals/qhexedit/xbytearray.h b/externals/qhexedit/xbytearray.h new file mode 100644 index 000000000..2b67c61b8 --- /dev/null +++ b/externals/qhexedit/xbytearray.h @@ -0,0 +1,66 @@ +#ifndef XBYTEARRAY_H +#define XBYTEARRAY_H + +/** \cond docNever */ + +#include <QtCore> + +/*! XByteArray represents the content of QHexEcit. +XByteArray comprehend the data itself and informations to store if it was +changed. The QHexEdit component uses these informations to perform nice +rendering of the data + +XByteArray also provides some functionality to insert, replace and remove +single chars and QByteArras. Additionally some functions support rendering +and converting to readable strings. +*/ +class XByteArray +{ +public: + explicit XByteArray(); + + int addressOffset(); + void setAddressOffset(int offset); + + int addressWidth(); + void setAddressWidth(int width); + + QByteArray & data(); + void setData(QByteArray data); + + bool dataChanged(int i); + QByteArray dataChanged(int i, int len); + void setDataChanged(int i, bool state); + void setDataChanged(int i, const QByteArray & state); + + int realAddressNumbers(); + int size(); + + QByteArray & insert(int i, char ch); + QByteArray & insert(int i, const QByteArray & ba); + + QByteArray & remove(int pos, int len); + + QByteArray & replace(int index, char ch); + QByteArray & replace(int index, const QByteArray & ba); + QByteArray & replace(int index, int length, const QByteArray & ba); + + QChar asciiChar(int index); + QString toRedableString(int start=0, int end=-1); + +signals: + +public slots: + +private: + QByteArray _data; + QByteArray _changedData; + + int _addressNumbers; // wanted width of address area + int _addressOffset; // will be added to the real addres inside bytearray + int _realAddressNumbers; // real width of address area (can be greater then wanted width) + int _oldSize; // size of data +}; + +/** \endcond docNever */ +#endif // XBYTEARRAY_H |