summaryrefslogtreecommitdiffabout
path: root/include/sitecing/component_factory.h
Unidiff
Diffstat (limited to 'include/sitecing/component_factory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/component_factory.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/include/sitecing/component_factory.h b/include/sitecing/component_factory.h
new file mode 100644
index 0000000..a208ed1
--- a/dev/null
+++ b/include/sitecing/component_factory.h
@@ -0,0 +1,84 @@
1#ifndef __SITECING_COMPONENT_FACTORY_H
2#define __SITECING_COMPONENT_FACTORY_H
3
4#include <string>
5#include <list>
6#include <stdexcept>
7#include "sitecing/file_factory.h"
8#include "sitecing/configuration.h"
9
10/**
11 * @file
12 * @brief The component_factory class declaration.
13 */
14
15namespace sitecing {
16 using namespace std;
17
18 /**
19 * @brief The components builder.
20 */
21 class component_factory : public file_factory {
22 public:
23 /**
24 * Path to the source files root.
25 */
26 string root_source;
27 /**
28 * Path to the root of the intermediate files storage.
29 */
30 string root_intermediate;
31 /**
32 * Output path for .so components.
33 */
34 string root_so;
35 /**
36 * Reference to the configuration container.
37 */
38 configuration& config;
39
40 /**
41 * @param c reference to the configuration container.
42 */
43 component_factory(configuration& c);
44
45 /**
46 * @overload file_factory::get_dependencies()
47 */
48 virtual void get_dependencies(const string& dst,file_list_t& deps);
49 /**
50 * @overload file_factory::is_uptodate()
51 */
52 virtual bool is_uptodate(const string& dst,file_list_t *deps=NULL);
53 /**
54 * @overload file_factory::build()
55 */
56 virtual void build(const string& dst);
57
58 /**
59 * Helper function for executing external command.
60 * @param cmd the command to execute.
61 * @param args the command line arguments.
62 * @param stdo stdout for the child process.
63 * @param stde stderr for the child process.
64 * @return exit code.
65 */
66 int execute(const string& cmd,const list<string>& args,int stdo,int stde);
67 /**
68 * Fetch the class name of the component.
69 * @param component the component.
70 * @return the class name.
71 */
72 string get_classname(const string& component);
73 /**
74 * Get the components from which the target component has been
75 * derived.
76 * @param component the target component
77 * @param rv where to store the list of ancestors.
78 */
79 void get_ancestors(const string& component,file_list_t &rv);
80 };
81
82}
83
84#endif /* __SITECING_COMPONENT_FACTORY_H */