Cupt
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cupt::HashSums Class Reference

hash sums More...

#include <cupt/hashsums.hpp>

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? More...
 
bool match (const HashSums &other) const
 compares with other HashSums object More...
 
bool empty () const
 does object contain no hash sums? More...
 
void fill (const string &path)
 fills the object with the hash sums of the file content More...
 

Static Public Member Functions

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

Public Attributes

string values [Count]
 array of hash sums
 

Detailed Description

hash sums

Member Function Documentation

◆ empty()

bool cupt::HashSums::empty ( ) const

does object contain no hash sums?

Returns
true if yes, false if no

◆ fill()

void cupt::HashSums::fill ( const string &  path)

fills the object with the hash sums of the file content

Parameters
pathpath to a file

◆ getHashOfString()

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

◆ match()

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

◆ verify()

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: