2
This file is part of hugin.
4
hugin is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 2 of the License, or
7
(at your option) any later version.
9
hugin is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with hugin. If not, see <http://www.gnu.org/licenses/>.
19
* @file MakefileItem.h
21
* Created on: May 25, 2010
22
* @author Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
25
#ifndef MAKEFILEITEM_H_
26
#define MAKEFILEITEM_H_
29
#include "Manageable.h"
35
* The virtual baseclass for all objects that appear in the Makefile.
36
* Subclasses must implement \ref print which allows us to write them to
37
* an ostream, like a string, nice :).
38
* The various implementations of \ref print have to take care of proper
39
* makefile compatible output.
41
class MAKEIMPEX MakefileItem
50
/// Removes the item from the Makefile
51
virtual ~MakefileItem()
54
Makefile::remove(this);
57
/// @return A string representation of the MakefileItem.
58
virtual string toString()=0;
59
/// Write the items representation to an ostream in a makefile compatible way.
60
void print(ostream& os)
64
/// Allow casts to string, very nice!
70
/// Adds this to the Makefile item list.
73
Makefile::getSingleton().add(this);
79
/// Allows writing to ostreams.
80
MAKEIMPEX ostream& operator<<(ostream& stream, MakefileItem& item);
82
/// Allows adding strings an MakefileItems
83
MAKEIMPEX string operator+(const string& str, MakefileItem& item);
84
/// Allows adding strings an MakefileItems
85
MAKEIMPEX string operator+(MakefileItem& item, const string& str);
88
* This class is used to mark MakefileItems that can be used directly, like most can.
89
* The only exception is currently VariableDef and VariableRef, they can only be used
90
* together with their parent Variable.
92
class MAKEIMPEX PrimaryMakefileItem : public MakefileItem, public Manageable
95
PrimaryMakefileItem() {}
96
virtual ~PrimaryMakefileItem() {}
100
#endif /* MAKEFILEITEM_H_ */