MakefileItem.h

Go to the documentation of this file.
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 MAKEFILEITEM_H_
00026 #define MAKEFILEITEM_H_
00027 
00028 #include "Makefile.h"
00029 #include "Manageable.h"
00030 
00031 namespace makefile
00032 {
00033 
00041 class MAKEIMPEX MakefileItem
00042 {
00043         bool added;
00044 public:
00045         MakefileItem()
00046         :added(false)
00047         {
00048         }
00049 
00051         virtual ~MakefileItem()
00052         {
00053                 if(added)
00054                         Makefile::remove(this);
00055         }
00056 
00058         virtual string toString()=0;
00060         void print(ostream& os)
00061         {
00062                 os << toString();
00063         }
00065         operator string()
00066         {
00067                 return toString();
00068         }
00069 
00071         virtual void add()
00072         {
00073                 Makefile::getSingleton().add(this);
00074                 added = true;
00075         }
00076 
00077 };
00078 
00080 MAKEIMPEX ostream& operator<<(ostream& stream, MakefileItem& item);
00081 
00083 MAKEIMPEX string operator+(const string& str, MakefileItem& item);
00085 MAKEIMPEX string operator+(MakefileItem& item, const string& str);
00086 
00092 class MAKEIMPEX PrimaryMakefileItem : public MakefileItem, public Manageable
00093 {
00094 public:
00095         PrimaryMakefileItem() {}
00096         virtual ~PrimaryMakefileItem() {}
00097 };
00098 
00099 }
00100 #endif /* MAKEFILEITEM_H_ */

Generated on 26 Nov 2014 for Hugintrunk by  doxygen 1.4.7