about summary refs log tree commit diff
path: root/src/hash.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-06-15T13·41+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-06-15T13·41+0000
commit21fe717ce2027187e553d1edec65ef68b5d3c702 (patch)
tree34ac1a94bb500f25793daba6f362c51240503ffe /src/hash.hh
parentf66055fa1ef3eb208666b5ace7b5ab16bf7e8980 (diff)
* Refactoring: hash class.
Diffstat (limited to 'src/hash.hh')
-rw-r--r--src/hash.hh34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/hash.hh b/src/hash.hh
new file mode 100644
index 000000000000..162b2b1c8fb6
--- /dev/null
+++ b/src/hash.hh
@@ -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 */