Cupt
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
cupt::HashSums Class Reference

hash sums More...

#include <cupt/hashsums.hpp>

List of all members.

Public Types

enum  Type { MD5, SHA1, SHA256, Count }
 hash sum type

Public Member Functions

string & operator[] (const Type &type)
 shortcut to values[type]
const string & operator[] (const Type &type) const
 shortcut to values[type]
bool verify (const string &path) const
 does file content match hash sums?
bool match (const HashSums &other) const
 compares with other HashSums object
bool empty () const
 does object contain no hash sums?
void fill (const string &path)
 fills the object with the hash sums of the file content

Static Public Member Functions

static string getHashOfString (const Type &type, const string &pattern)
 gets hash of the string

Public Attributes

string values [Count]
 array of hash sums

Detailed Description

hash sums


Member Function Documentation

bool cupt::HashSums::empty ( ) const

does object contain no hash sums?

Returns:
true if yes, false if no
void cupt::HashSums::fill ( const string &  path)

fills the object with the hash sums of the file content

Parameters:
pathpath to a file
static string cupt::HashSums::getHashOfString ( const Type type,
const string &  pattern 
) [static]

gets hash of the string

Parameters:
typehash type
patterndata to hash
Returns:
hash
bool cupt::HashSums::match ( const HashSums other) const

compares with other HashSums object

Returns:
If there are no hash sums, defined in both objects, returns false. If there are any, returns true if all matched and false otherwise
Parameters:
otherobject to compare with
Exceptions:
Exceptionif empty or other is empty
bool cupt::HashSums::verify ( const string &  path) const

does file content match hash sums?

Parameters:
pathpath to a file
Returns:
true if yes, false if no
Exceptions:
Exceptionif empty

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