summaryrefslogtreecommitdiffstats
path: root/quazip/quachecksum32.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-01-11 02:25:40 +0100
committerPetr Mrázek <peterix@gmail.com>2013-01-11 02:25:40 +0100
commitb1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc (patch)
treef7c909b4080e6d1868e601609741450330dc9a1e /quazip/quachecksum32.h
parentd6d5c86a736537828a59ddc6389d5d0490942f8c (diff)
downloadMultiMC-b1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc.tar
MultiMC-b1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc.tar.gz
MultiMC-b1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc.tar.lz
MultiMC-b1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc.tar.xz
MultiMC-b1d00fce8da901b31fa52ea59b4bc3c8edb9d9cc.zip
CMake build system, big pile of libs: bspatch, quazip, java, the launcher
Diffstat (limited to 'quazip/quachecksum32.h')
-rw-r--r--quazip/quachecksum32.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/quazip/quachecksum32.h b/quazip/quachecksum32.h
new file mode 100644
index 00000000..773ec2a4
--- /dev/null
+++ b/quazip/quachecksum32.h
@@ -0,0 +1,54 @@
+#ifndef QUACHECKSUM32_H
+#define QUACHECKSUM32_H
+
+#include <QtCore/QByteArray>
+#include "quazip_global.h"
+
+/// Checksum interface.
+/** \class QuaChecksum32 quachecksum32.h <quazip/quachecksum32.h>
+ * This is an interface for 32 bit checksums.
+ * Classes implementing this interface can calcunate a certin
+ * checksum in a single step:
+ * \code
+ * QChecksum32 *crc32 = new QuaCrc32();
+ * rasoult = crc32->calculate(data);
+ * \endcode
+ * or by streaming the data:
+ * \code
+ * QChecksum32 *crc32 = new QuaCrc32();
+ * while(!fileA.atEnd())
+ * crc32->update(fileA.read(bufSize));
+ * resoultA = crc32->value();
+ * crc32->reset();
+ * while(!fileB.atEnd())
+ * crc32->update(fileB.read(bufSize));
+ * resoultB = crc32->value();
+ * \endcode
+ */
+class QUAZIP_EXPORT QuaChecksum32
+{
+
+public:
+ ///Calculates the checksum for data.
+ /** \a data source data
+ * \return data checksum
+ *
+ * This function has no efect on the value returned by value().
+ */
+ virtual quint32 calculate(const QByteArray &data) = 0;
+
+ ///Resets the calculation on a checksun for a stream.
+ virtual void reset() = 0;
+
+ ///Updates the calculated checksum for the stream
+ /** \a buf next portion of data from the stream
+ */
+ virtual void update(const QByteArray &buf) = 0;
+
+ ///Value of the checksum calculated for the stream passed throw update().
+ /** \return checksum
+ */
+ virtual quint32 value() = 0;
+};
+
+#endif //QUACHECKSUM32_H