00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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