1
#ifndef QUACHECKSUM32_H
2
#define QUACHECKSUM32_H
5
#include "quazip_global.h"
7
/// Checksum interface.
8
/** \class QuaChecksum32 quachecksum32.h <quazip/quachecksum32.h>
9
* This is an interface for 32 bit checksums.
10
* Classes implementing this interface can calcunate a certin
11
* checksum in a single step:
13
* QChecksum32 *crc32 = new QuaCrc32();
14
* rasoult = crc32->calculate(data);
16
* or by streaming the data:
18
* QChecksum32 *crc32 = new QuaCrc32();
19
* while(!fileA.atEnd())
20
* crc32->update(fileA.read(bufSize));
21
* resoultA = crc32->value();
23
* while(!fileB.atEnd())
24
* crc32->update(fileB.read(bufSize));
25
* resoultB = crc32->value();
28
class QUAZIP_EXPORT QuaChecksum32
32
///Calculates the checksum for data.
33
/** \a data source data
34
* \return data checksum
36
* This function has no efect on the value returned by value().
38
virtual quint32 calculate(const QByteArray &data) = 0;
40
///Resets the calculation on a checksun for a stream.
41
virtual void reset() = 0;
43
///Updates the calculated checksum for the stream
44
/** \a buf next portion of data from the stream
46
virtual void update(const QByteArray &buf) = 0;
48
///Value of the checksum calculated for the stream passed throw update().
51
virtual quint32 value() = 0;
54
#endif //QUACHECKSUM32_H