-
Notifications
You must be signed in to change notification settings - Fork 0
/
Filestamp.h
48 lines (34 loc) · 899 Bytes
/
Filestamp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Filestamp.h
*
* Created on: 10 juin 2015
* Author: Pascal Séguy
*/
#ifndef FILESTAMP_H_
#define FILESTAMP_H_
#include <boost/filesystem/operations.hpp>
typedef std::string hash_t;
//
// A file class with an additional hash of the file.
//
class Filestamp: public boost::filesystem::directory_entry
{
protected:
hash_t hash; // the hash on the file
public:
Filestamp();
Filestamp(boost::filesystem::directory_entry file);
virtual ~Filestamp();
/**
* hash getter
*/
hash_t getHash() const { return(hash); }
long hard_link_count() const { return boost::filesystem::hard_link_count(path()); }
static std::size_t slimit; // sile limit of file in KiB
friend std::ostream &operator<<(std::ostream &cout, const Filestamp &file);
/**
* Returns an escaped value of the file name suitable for bash
*/
std::string bash_str() const;
};
#endif /* FILESTAMP_H_ */