1 | //----------------------------------------------------------- |
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
3 | // arnault@lal.in2p3.fr |
---|
4 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
5 | //----------------------------------------------------------- |
---|
6 | |
---|
7 | #ifndef __cmt_project_h__ |
---|
8 | #define __cmt_project_h__ |
---|
9 | |
---|
10 | #include "cmt_parser.h" |
---|
11 | #include "cmt_system.h" |
---|
12 | #include "cmt_awk.h" |
---|
13 | |
---|
14 | class Project; |
---|
15 | |
---|
16 | class ProjectFactory : public IProjectFactory |
---|
17 | { |
---|
18 | public: |
---|
19 | static IProjectFactory& instance (); |
---|
20 | |
---|
21 | public: |
---|
22 | void reset (); |
---|
23 | void create_project (const cmt_string& path, |
---|
24 | const cmt_string& path_source); |
---|
25 | |
---|
26 | private: |
---|
27 | Project* m_first; |
---|
28 | Project* m_previous; |
---|
29 | int m_id; |
---|
30 | }; |
---|
31 | |
---|
32 | class IProjectAction |
---|
33 | { |
---|
34 | public: |
---|
35 | virtual bool run (const Project& project) = 0; |
---|
36 | }; |
---|
37 | |
---|
38 | class Project |
---|
39 | { |
---|
40 | public: |
---|
41 | |
---|
42 | typedef cmt_vector<Project> ProjectVector; |
---|
43 | |
---|
44 | static void create (const cmt_string& name); |
---|
45 | |
---|
46 | static Project* find_by_name (const cmt_string& name); |
---|
47 | static Project* find_by_cmtpath (const cmt_string& cmtpath); |
---|
48 | static Project* get_current (); |
---|
49 | static Project* add (const cmt_string& name); |
---|
50 | |
---|
51 | static ProjectVector& projects (); |
---|
52 | static void clear_all (); |
---|
53 | static void show_all (); |
---|
54 | static void show_paths (); |
---|
55 | static const cmt_string& get_project_file_name (); |
---|
56 | |
---|
57 | static void fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections); |
---|
58 | |
---|
59 | static void broadcast (IProjectAction& action); |
---|
60 | static void reverse_broadcast (IProjectAction& action); |
---|
61 | static void scan_paths (PathScanner& scanner, PathScanner::actor& actor); |
---|
62 | static void scan_paths_for_package (PathScanner& scanner, const cmt_string& name); |
---|
63 | |
---|
64 | static cmt_string find_in_cmt_paths (const cmt_string& path); |
---|
65 | |
---|
66 | public: |
---|
67 | |
---|
68 | Project (); |
---|
69 | |
---|
70 | const cmt_string& get_name () const; |
---|
71 | const cmt_string& get_cmtpath () const; |
---|
72 | const cmt_string& get_cmtpath_pwd () const; |
---|
73 | const cmt_string& get_cmtpath_source () const; |
---|
74 | void set_name (const cmt_string& new_name); |
---|
75 | void set_cmtpath (const cmt_string& path); |
---|
76 | void set_cmtpath_pwd (const cmt_string& path); |
---|
77 | void set_cmtpath_source (const cmt_string& source); |
---|
78 | void set_predecessor (Project* predecessor); |
---|
79 | void set_reference (Project* reference); |
---|
80 | void clear (); |
---|
81 | void configure (); |
---|
82 | |
---|
83 | Project& operator = (const Project& other); |
---|
84 | bool operator == (const cmt_string& name) const; |
---|
85 | bool operator != (const cmt_string& name) const; |
---|
86 | |
---|
87 | void show () const; |
---|
88 | void show_strategies () const; |
---|
89 | int get_build_strategy () const; |
---|
90 | int get_setup_strategy () const; |
---|
91 | void set_build_strategy (int mask, int strategy); |
---|
92 | void set_setup_strategy (int mask, int strategy); |
---|
93 | |
---|
94 | private: |
---|
95 | cmt_string m_name; |
---|
96 | |
---|
97 | Project* m_reference; |
---|
98 | Project* m_predecessor; |
---|
99 | |
---|
100 | cmt_string m_cmtpath; |
---|
101 | cmt_string m_cmtpath_pwd; |
---|
102 | cmt_string m_cmtpath_source; |
---|
103 | |
---|
104 | int m_build_strategy_mask; |
---|
105 | int m_build_strategy; |
---|
106 | int m_setup_strategy_mask; |
---|
107 | int m_setup_strategy; |
---|
108 | |
---|
109 | bool m_configured; |
---|
110 | |
---|
111 | Tag* m_prototypes_tag; |
---|
112 | Tag* m_no_prototypes_tag; |
---|
113 | Tag* m_rebuild_makefiles_tag; |
---|
114 | Tag* m_keep_makefiles_tag; |
---|
115 | Tag* m_with_installarea_tag; |
---|
116 | Tag* m_without_installarea_tag; |
---|
117 | |
---|
118 | Tag* m_setup_config_tag; |
---|
119 | Tag* m_setup_no_config_tag; |
---|
120 | Tag* m_setup_root_tag; |
---|
121 | Tag* m_setup_no_root_tag; |
---|
122 | Tag* m_setup_cleanup_tag; |
---|
123 | Tag* m_setup_no_cleanup_tag; |
---|
124 | |
---|
125 | }; |
---|
126 | |
---|
127 | |
---|
128 | #endif |
---|