00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00025 #ifndef VARIABLE_H_
00026 #define VARIABLE_H_
00027
00028 #include "VariableDef.h"
00029 #include "VariableRef.h"
00030 #include "Makefile.h"
00031 #include "Manageable.h"
00032 #include <vector>
00033
00034 namespace makefile
00035 {
00036
00042 class MAKEIMPEX Variable : public Manageable
00043 {
00044 protected:
00045 string name;
00047 std::vector<string> values;
00049 string separator;
00051 VariableDef* def;
00053 VariableRef* ref;
00054 Makefile::QuoteMode quotemode;
00056 bool exported;
00057
00061 virtual void checkName();
00065 virtual void checkValue();
00066
00067 void Create();
00068
00070 Variable(string name_);
00071
00072 private:
00073 Variable(const Variable&);
00074 public:
00076 Variable(string name_, string value_, Makefile::QuoteMode quotemode_ = Makefile::SHELL);
00078 Variable(string name_, double value_, Makefile::QuoteMode quotemode_ = Makefile::NONE);
00083 Variable(string name_,std::vector<string>::iterator start, std::vector<string>::iterator end,
00084 Makefile::QuoteMode quotemode_ = Makefile::SHELL, string separator_ = " ");
00085
00086 virtual ~Variable();
00087
00088 virtual const string getName()
00089 {
00090 return name;
00091 }
00095 virtual const string getValue();
00099 virtual const string getquotedValue();
00100
00104 virtual const std::vector<string>& getValues()
00105 {
00106 return values;
00107 }
00108
00109 virtual VariableDef& getDef()
00110 {
00111 return *def;
00112 }
00113
00114 virtual VariableRef& getRef()
00115 {
00116 return *ref;
00117 }
00118
00119 void setQuoteMode(Makefile::QuoteMode mode)
00120 {
00121 quotemode = mode;
00122 }
00123
00124 void setExport(bool ex)
00125 {
00126 exported = ex;
00127 }
00128 bool getExport()
00129 {
00130 return exported;
00131 }
00132
00133 };
00134
00135 }
00136
00137 #endif