cbp2make
Makefile generation tool for Code::Blocks IDE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
makefile.h
Go to the documentation of this file.
1 /*
2  cbp2make : Makefile generation tool for the Code::Blocks IDE
3  Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com)
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 //------------------------------------------------------------------------------
20 #ifndef MAKEFILE_H
21 #define MAKEFILE_H
22 //------------------------------------------------------------------------------
23 #include "stlstrings.h"
24 #include "stlconfig.h"
25 //------------------------------------------------------------------------------
26 
28 {
29  private:
33  public:
34  CString& Name(void) { return m_Name; }
35  CStringList& Values(void) { return m_Values; }
36  CString GetValue(const int Index = 0);
37  void SetValue(const CString& NewValue, const int Index = 0);
38  void AddValue(const CString& NewValue);
39  bool& Multiline(void) { return m_Multiline; }
40  CString JoinValues(void);
41  public:
42  void Clear(void);
43  void Show(void);
44  public:
45  CMakefileVariable(void);
46  ~CMakefileVariable(void);
47 };
48 
50 {
51  private:
56  public:
57  CString& Target(void) { return m_Target; }
59  CStringList& Commands(void) { return m_Commands; }
60  bool& Multiline(void) { return m_Multiline; }
62  public:
63  void Clear(void);
64  void Show(void);
65  public:
66  CMakefileRule(void);
67  ~CMakefileRule(void);
68 };
69 
71 {
72  private:
74  std::vector<CMakefileVariable *> m_Macros;
75  std::vector<CMakefileVariable *> m_EnvVars;
76  std::vector<CMakefileRule *> m_Rules;
79  protected:
80  CMakefileVariable *FindMacro(const CString& Name);
81  CMakefileVariable *FindEnvVar(const CString& Name);
82  public:
83  void Clear(void);
84  void Show(void);
85  public:
86  CStringList& Header(void);
87  std::vector<CMakefileVariable *>& Macros(void);
88  std::vector<CMakefileVariable *>& EnvVars(void);
89  CMakefileVariable& AddMacro(const CString& Name, const CString& Value);
90  CMakefileVariable& AddEnvVar(const CString& Name, const CString& Value);
91  size_t RulesCount(void) const;
92  CMakefileRule& GetRule(const size_t Index);
93  CMakefileRule& AddRule(const CString& TargetName);
94  public:
95  CMakefileSection(void);
96  ~CMakefileSection(void);
97 };
98 
99 class CMakefile
100 {
101  private:
102  std::vector<CMakefileSection *> m_Sections;
104  public:
105  void Clear(void);
106  void Show(void);
107  public:
108  size_t SectionCount(void) const;
109  CMakefileSection& GetSection(const size_t Section);
110  CStringList& Header(const size_t Section = 0);
111  CMakefileSection& AddSection(size_t *Section = 0);
112  CMakefileVariable& AddMacro(const CString& Name, const CString& Value, const size_t Section = 0);
113  CMakefileVariable& AddEnvVar(const CString& Name, const CString& Value, const size_t Section = 0);
114  size_t RulesCount(const size_t Section = 0);
115  CMakefileRule& GetRule(const size_t Index, const size_t Section = 0);
116  CMakefileRule& AddRule(const CString& TargetName, const size_t Section = 0);
117  CStringList& GetText(void);
118  CStringList& Update(void);
119  public:
120  CMakefile(void);
121  ~CMakefile(void);
122 };
123 
124 #endif
125 //------------------------------------------------------------------------------