source: Vago/Libs/quazip-0.7.2/quazip/quachecksum32.h@ 1079

Last change on this file since 1079 was 1050, checked in by s10k, 8 years ago
File size: 2.2 KB
Line 
1#ifndef QUACHECKSUM32_H
2#define QUACHECKSUM32_H
3
4/*
5Copyright (C) 2005-2014 Sergey A. Tachenov
6
7This file is part of QuaZIP.
8
9QuaZIP is free software: you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published by
11the Free Software Foundation, either version 2.1 of the License, or
12(at your option) any later version.
13
14QuaZIP is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License
20along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
21
22See COPYING file for the full LGPL text.
23
24Original ZIP package is copyrighted by Gilles Vollant and contributors,
25see quazip/(un)zip.h files for details. Basically it's the zlib license.
26*/
27
28#include <QByteArray>
29#include "quazip_global.h"
30
31/// Checksum interface.
32/** \class QuaChecksum32 quachecksum32.h <quazip/quachecksum32.h>
33 * This is an interface for 32 bit checksums.
34 * Classes implementing this interface can calcunate a certin
35 * checksum in a single step:
36 * \code
37 * QChecksum32 *crc32 = new QuaCrc32();
38 * rasoult = crc32->calculate(data);
39 * \endcode
40 * or by streaming the data:
41 * \code
42 * QChecksum32 *crc32 = new QuaCrc32();
43 * while(!fileA.atEnd())
44 * crc32->update(fileA.read(bufSize));
45 * resoultA = crc32->value();
46 * crc32->reset();
47 * while(!fileB.atEnd())
48 * crc32->update(fileB.read(bufSize));
49 * resoultB = crc32->value();
50 * \endcode
51 */
52class QUAZIP_EXPORT QuaChecksum32
53{
54
55public:
56 ///Calculates the checksum for data.
57 /** \a data source data
58 * \return data checksum
59 *
60 * This function has no efect on the value returned by value().
61 */
62 virtual quint32 calculate(const QByteArray &data) = 0;
63
64 ///Resets the calculation on a checksun for a stream.
65 virtual void reset() = 0;
66
67 ///Updates the calculated checksum for the stream
68 /** \a buf next portion of data from the stream
69 */
70 virtual void update(const QByteArray &buf) = 0;
71
72 ///Value of the checksum calculated for the stream passed throw update().
73 /** \return checksum
74 */
75 virtual quint32 value() = 0;
76};
77
78#endif //QUACHECKSUM32_H
Note: See TracBrowser for help on using the repository browser.