cbp2make
Makefile generation tool for Code::Blocks IDE
cbglobalvar.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 CBGLOBALVAR_H
21 #define CBGLOBALVAR_H
22 //------------------------------------------------------------------------------
23 #include "stlstrings.h"
24 #include "stlconfig.h"
25 //------------------------------------------------------------------------------
26 
27 class TiXmlElement;
28 class CGlobalVariableSet;
29 
31 {
32  private:
35  // standard fields
42  // user fields
44  public:
45  CString& Name(void) { return m_Name; }
46  CString& Description(void) { return m_Description; }
47  CString Base(void);
48  CString Include(void);
49  CString Lib(void);
50  CString& Obj(void) { return m_Obj; }
51  CString& Cflags(void) { return m_Cflags; }
52  CString& Lflags(void) { return m_Lflags; }
53  public:
54  static CString Convert(const CString& Value, const int Case = 0);
55  int Count(void);
56  CString GetField(const int Index);
57  CString GetValue(const int Index);
58  void Clear(void);
59  void Add(const CString& Name, const CString& Value);
60  void Remove(const CString& Name);
61  void Read(const TiXmlElement *GlobalVariableRoot);
62  void Write(TiXmlElement *GlobalVariableRoot);
63  void Show(void);
64  public:
65  CGlobalVariable(void);
66  ~CGlobalVariable(void);
67 };
68 
70 {
71  private:
73  std::vector<CGlobalVariable *> m_Variables;
74  bool m_Active;
75  //bool m_HaveDefaults;
76  public:
77  CString& Name(void) { return m_Name; }
78  bool& Active(void) { return m_Active; }
79  public:
80  void Clear(void);
81  size_t Count(void) const { return m_Variables.size(); };
82  CGlobalVariable *Get(const size_t Index);
83  CGlobalVariable *Find(const CString& Name);
84  CGlobalVariable *Add(const CString& Name, const CString& Description = "");
85  void Remove(const CString& Name);
86  void Read(const TiXmlElement *GlobalVariableSetRoot);
87  void Write(TiXmlElement *GlobalVariableSetRoot);
88  void Show(void);
89  public:
90  CGlobalVariableSet(void);
91  ~CGlobalVariableSet(void);
92 };
93 
95 {
96  private:
97  std::vector<CGlobalVariableSet *> m_VariableSets;
98  public:
99  public:
100  void Clear(void);
101  size_t Count(void) const { return m_VariableSets.size(); };
102  CGlobalVariableSet *Get(const size_t Index);
103  CGlobalVariableSet *Find(const CString& Name);
104  CGlobalVariableSet *Add(const CString& Name);
105  void AddDefault(void);
106  void Remove(const CString& Name);
107  void Read(const TiXmlElement *GlobalVariableConfigRoot);
108  void Write(TiXmlElement *GlobalVariableConfigRoot);
109  void Show(void);
110  public:
111  CGlobalVariableConfig(void);
112  ~CGlobalVariableConfig(void);
113 };
114 
115 #endif
116 //------------------------------------------------------------------------------
CString m_Obj
Value of the built-in "Obj" field of the variable.
Definition: cbglobalvar.h:39
CString Lib(void)
Value of the built-in "Lib" field of the variable.
Definition: cbglobalvar.cpp:145
CString & Cflags(void)
Value of the built-in "Cflags" field of the variable.
Definition: cbglobalvar.h:51
CString m_Include
Value of the built-in "Include" field of the variable.
Definition: cbglobalvar.h:37
CGlobalVariable(void)
Creates global compiler variable.
Definition: cbglobalvar.cpp:28
CString m_Lflags
Value of the built-in "Lflags" field of the variable.
Definition: cbglobalvar.h:41
std::vector< CGlobalVariable * > m_Variables
List of global compiler variables.
Definition: cbglobalvar.h:73
CString m_Cflags
Value of the built-in "Cflags" field of the variable.
Definition: cbglobalvar.h:40
size_t Count(void) const
Returns the number of variable sets in configuration.
Definition: cbglobalvar.h:101
Manages global compiler variables configuration.
Definition: cbglobalvar.h:94
std::vector< CGlobalVariableSet * > m_VariableSets
List of variable sets.
Definition: cbglobalvar.h:97
size_t Count(void) const
Returns number of variables.
Definition: cbglobalvar.h:81
CString GetField(const int Index)
Returns name of user-defined field.
Definition: cbglobalvar.cpp:43
CString & Lflags(void)
Value of the built-in "Lflags" field of the variable.
Definition: cbglobalvar.h:52
void Write(TiXmlElement *GlobalVariableRoot)
Writes the global variable settings to an XML document.
Definition: cbglobalvar.cpp:291
CString & Obj(void)
Value of the built-in "Obj" field of the variable.
Definition: cbglobalvar.h:50
CString & Description(void)
Description of the variable.
Definition: cbglobalvar.h:46
bool m_Active
Indicates that this variable set should be defined in makefile.
Definition: cbglobalvar.h:74
CString m_Name
Name of the variable set.
Definition: cbglobalvar.h:72
void Add(const CString &Name, const CString &Value)
Adds new user-defined field.
Definition: cbglobalvar.cpp:173
Definition: stlstrings.h:32
bool & Active(void)
Indicates that this variable set should be defined in makefile.
Definition: cbglobalvar.h:78
CString m_Base
Value of the built-in default field of the variable.
Definition: cbglobalvar.h:36
CString m_Description
Description of the variable.
Definition: cbglobalvar.h:34
static CString Convert(const CString &Value, const int Case=0)
Definition: cbglobalvar.cpp:53
Contains properties of global compiler variables.
Definition: cbglobalvar.h:30
CString & Name(void)
Name of the set.
Definition: cbglobalvar.h:77
int Count(void)
Returns number of user-defined fields.
Definition: cbglobalvar.cpp:38
Manages a set of global compiler variables.
Definition: cbglobalvar.h:69
void Clear(void)
Resets the global compiler variable to the initial state.
Definition: cbglobalvar.cpp:161
void Remove(const CString &Name)
Removes user-defined field.
Definition: cbglobalvar.cpp:201
CString GetValue(const int Index)
Returns value of user-defined field.
Definition: cbglobalvar.cpp:48
CString Base(void)
Value of the built-in default field of the variable.
Definition: cbglobalvar.cpp:120
CString & Name(void)
Name of the variable.
Definition: cbglobalvar.h:45
~CGlobalVariable(void)
Destroys global compiler variable.
Definition: cbglobalvar.cpp:33
CString m_Lib
Value of the built-in "Lib" field of the variable.
Definition: cbglobalvar.h:38
Definition: stlconfig.h:26
void Show(void)
Prints the global compiler variable contents to standard output.
Definition: cbglobalvar.cpp:317
CConfiguration m_Fields
User-defined fields of the global compiler variable.
Definition: cbglobalvar.h:43
void Read(const TiXmlElement *GlobalVariableRoot)
Reads the global variable settings from an XML document.
Definition: cbglobalvar.cpp:206
CString Include(void)
Value of the built-in "Include" field of the variable.
Definition: cbglobalvar.cpp:129
CString m_Name
Name of the variable.
Definition: cbglobalvar.h:33