00001 /* 00002 This file is part of hugin. 00003 00004 hugin is free software: you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation, either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 hugin is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with hugin. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00025 #ifndef CONDITIONAL_H_ 00026 #define CONDITIONAL_H_ 00027 00031 #include "MakefileItem.h" 00032 00033 #include <vector> 00034 00035 namespace makefile 00036 { 00037 00048 class MAKEIMPEX Conditional: public PrimaryMakefileItem 00049 { 00051 virtual string printif()=0; 00053 std::vector<MakefileItem*> ifblock; 00055 std::vector<MakefileItem*> elseblock; 00056 public: 00057 Conditional() 00058 {} 00059 virtual ~Conditional() 00060 {} 00061 00062 void addToIf(MakefileItem& item) 00063 { 00064 ifblock.push_back(&item); 00065 } 00066 void addToElse(MakefileItem& item) 00067 { 00068 elseblock.push_back(&item); 00069 } 00070 00071 virtual string toString(); 00072 }; 00073 00074 class ConditionalEQ: public makefile::Conditional 00075 { 00076 string arg1, arg2; 00077 virtual string printif() 00078 { 00079 return cstr("ifeq (") + arg1 + cstr(",") + arg2 + cstr(")\n"); 00080 } 00081 public: 00082 ConditionalEQ(string arg1_, string arg2_) 00083 :arg1(arg1_), arg2(arg2_) 00084 {} 00085 virtual ~ConditionalEQ() 00086 {} 00087 00088 }; 00089 00090 class ConditionalNEQ: public makefile::Conditional 00091 { 00092 string arg1, arg2; 00093 virtual string printif() 00094 { 00095 return cstr("ifneq (") + arg1 + cstr(",") + arg2 + cstr(")\n"); 00096 } 00097 public: 00098 ConditionalNEQ(string arg1_, string arg2_) 00099 :arg1(arg1_), arg2(arg2_) 00100 {} 00101 virtual ~ConditionalNEQ() 00102 {} 00103 00104 }; 00105 00106 class ConditionalDEF: public makefile::Conditional 00107 { 00108 string varname; 00109 virtual string printif() 00110 { 00111 return cstr("ifdef ") + varname + cstr("\n"); 00112 } 00113 public: 00114 ConditionalDEF(string varname_) 00115 :varname(varname_) 00116 {} 00117 virtual ~ConditionalDEF() 00118 {} 00119 00120 }; 00121 00122 class ConditionalNDEF: public makefile::Conditional 00123 { 00124 string varname; 00125 virtual string printif() 00126 { 00127 return cstr("ifndef ") + varname + cstr("\n"); 00128 } 00129 public: 00130 ConditionalNDEF(string varname_) 00131 :varname(varname_) 00132 {} 00133 virtual ~ConditionalNDEF() 00134 {} 00135 00136 }; 00137 00138 } 00139 00140 #endif /* CONDITIONAL_H_ */
1.3.9.1