summaryrefslogtreecommitdiffabout
path: root/include/sitecing/file_factory.h
Unidiff
Diffstat (limited to 'include/sitecing/file_factory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/file_factory.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/sitecing/file_factory.h b/include/sitecing/file_factory.h
new file mode 100644
index 0000000..7ec82da
--- a/dev/null
+++ b/include/sitecing/file_factory.h
@@ -0,0 +1,64 @@
1#ifndef __SITECING_FILE_FACTORY_H
2#define __SITECING_FILE_FACTORY_H
3
4#include <string>
5#include <list>
6
7/**
8 * @file
9 * @brief the file_factory class declaration.
10 */
11
12namespace sitecing {
13 using namespace std;
14
15 /**
16 * The factory class. Does the job similar to that which is done by make
17 * utility.
18 */
19 class file_factory {
20 public:
21 /**
22 * The recursion depth.
23 */
24 int depth;
25 /**
26 * The list of files type. The list of strings, in fact.
27 */
28 typedef list<string> file_list_t;
29
30 file_factory()
31 : depth(0) { }
32
33 /**
34 * Fetch depndencies for the given file.
35 * @param dst destination file.
36 * @param deps where to put dependencies to.
37 */
38 virtual void get_dependencies(const string& dst,file_list_t& deps) = 0;
39 /**
40 * Check if the destination is up to day.
41 * @param the destination file.
42 * @param deps if the deps pointer is non there, the dependencies
43 * retrieved will be stored there.
44 * @return true if yes.
45 * @see get_dependencies()
46 */
47 virtual bool is_uptodate(const string& dst,file_list_t* deps=0);
48 /**
49 * Build the file requested.
50 * @param dst the file requested.
51 */
52 virtual void build(const string& dst) = 0;
53 /**
54 * Make the file requested, which means: build it, unless it's
55 * uptodate.
56 * @see is_uptodate()
57 * @see build()
58 */
59 virtual void make(const string& dst);
60 };
61
62}
63
64#endif /* __SITECING_FILE_FACTORY_H */