summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/service/fileUtils.h
blob: 51c2875dc9febbc90c2852cb5de6a8d38894ae83 (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
#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);

			protected:
				struct stat st;
		};

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

			protected:
				void * data;
		};

	}
}

#endif