* Refactoring: hash class.
This commit is contained in:
parent
f66055fa1e
commit
21fe717ce2
8 changed files with 266 additions and 184 deletions
34
src/hash.hh
Normal file
34
src/hash.hh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef __HASH_H
|
||||
#define __HASH_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "util.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
struct Hash
|
||||
{
|
||||
static const unsigned int hashSize = 16;
|
||||
unsigned char hash[hashSize];
|
||||
|
||||
Hash();
|
||||
bool operator == (Hash & h2);
|
||||
bool operator != (Hash & h2);
|
||||
operator string() const;
|
||||
};
|
||||
|
||||
|
||||
class BadRefError : public Error
|
||||
{
|
||||
public:
|
||||
BadRefError(string _err) : Error(_err) { };
|
||||
};
|
||||
|
||||
|
||||
Hash parseHash(const string & s);
|
||||
bool isHash(const string & s);
|
||||
Hash hashFile(const string & fileName);
|
||||
|
||||
#endif /* !__HASH_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue