summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/service/fileUtils.h
blob: d73b1eff38872fff39f22c20d824a79ac1d3c211 (plain)
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
#ifndef GENTOOBROWSE_API_SERVICE_FILEUTILS_H
#define GENTOOBROWSE_API_SERVICE_FILEUTILS_H

#include <boost/filesystem/path.hpp>
#include <sys/stat.h>

namespace Gentoo {
	namespace Utils {
		namespace File {
			boost::filesystem::path operator/(const boost::filesystem::path & p, unsigned int n);
		}

		class FileHandle {
			public:
				FileHandle(const boost::filesystem::path & path);
				virtual ~FileHandle();

			protected:
				const int fh;
		};

		class FileHandleStat : public FileHandle {
			public:
				FileHandleStat(const boost::filesystem::path & path);

				const struct stat & getStat() const;

			protected:
				struct stat st;
		};

		class MemMap : public FileHandleStat {
			public:
				MemMap(const boost::filesystem::path & path);
				~MemMap();

				void * const data;
		};

	}
}

#endif