ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QuaCrc32 Class Reference

CRC32 checksum. More...

#include <quazip/quacrc32.h>

+ Inheritance diagram for QuaCrc32:
+ Collaboration diagram for QuaCrc32:

Public Member Functions

 QuaCrc32 ()
 
quint32 calculate (const QByteArray &data)
 Calculates the checksum for data. More...
 
void reset ()
 Resets the calculation on a checksun for a stream. More...
 
void update (const QByteArray &buf)
 Updates the calculated checksum for the stream. More...
 
quint32 value ()
 Value of the checksum calculated for the stream passed throw update(). More...
 

Private Attributes

quint32 checksum
 

Detailed Description

This class wrappers the crc32 function with the QuaChecksum32 interface. See QuaChecksum32 for more info.

Definition at line 35 of file quacrc32.h.

Constructor & Destructor Documentation

QuaCrc32::QuaCrc32 ( )

Definition at line 29 of file quacrc32.cpp.

References reset().

30 {
31  reset();
32 }
void reset()
Resets the calculation on a checksun for a stream.
Definition: quacrc32.cpp:39

+ Here is the call graph for this function:

Member Function Documentation

quint32 QuaCrc32::calculate ( const QByteArray &  data)
virtual

data source data

Returns
data checksum

This function has no efect on the value returned by value().

Implements QuaChecksum32.

Definition at line 34 of file quacrc32.cpp.

35 {
36  return crc32( crc32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() );
37 }
void QuaCrc32::reset ( )
virtual

Implements QuaChecksum32.

Definition at line 39 of file quacrc32.cpp.

References checksum.

Referenced by QuaCrc32().

40 {
41  checksum = crc32(0L, Z_NULL, 0);
42 }
quint32 checksum
Definition: quacrc32.h:47

+ Here is the caller graph for this function:

void QuaCrc32::update ( const QByteArray &  buf)
virtual

buf next portion of data from the stream

Implements QuaChecksum32.

Definition at line 44 of file quacrc32.cpp.

References checksum.

45 {
46  checksum = crc32( checksum, (const Bytef*)buf.data(), buf.size() );
47 }
quint32 checksum
Definition: quacrc32.h:47
quint32 QuaCrc32::value ( )
virtual
Returns
checksum

Implements QuaChecksum32.

Definition at line 49 of file quacrc32.cpp.

References checksum.

50 {
51  return checksum;
52 }
quint32 checksum
Definition: quacrc32.h:47

Field Documentation

quint32 QuaCrc32::checksum
private

Definition at line 47 of file quacrc32.h.

Referenced by reset(), update(), and value().


The documentation for this class was generated from the following files: