2
* misc.h is part of Brewtarget, and is Copyright Philip G. Lee
3
* (rocketman768@gmail.com), 2009.
5
* Brewtarget is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* Brewtarget is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27
#include "observable.h"
28
#include "BeerXMLElement.h"
33
class Misc : public Observable, public BeerXMLElement
38
Misc( const XmlNode *node );
39
Misc( const QDomNode& miscNode );
41
friend bool operator<(Misc &m1, Misc &m2);
42
friend bool operator==(Misc &m1, Misc &m2);
44
virtual void toXml(QDomDocument& doc, QDomNode& parent); // From BeerXMLElement
45
//std::string toXml();
48
void setName( const std::string &var );
49
void setType( const std::string &var );
50
void setUse( const std::string &var );
51
void setAmount( double var );
52
void setTime( double var );
53
void setAmountIsWeight( bool var );
54
void setUseFor( const std::string &var );
55
void setNotes( const std::string &var );
58
std::string getName() const;
59
std::string getType() const;
60
std::string getUse() const;
61
double getAmount() const;
62
double getTime() const;
63
bool getAmountIsWeight() const;
64
std::string getUseFor() const;
65
std::string getNotes() const;
71
static const int version = 1;
84
bool isValidType( const std::string &var );
85
bool isValidUse( const std::string &var );
88
class MiscException : public std::exception
92
virtual const char* what() const throw()
94
// Note: this temporary object might get destroyed too early.
95
// I'm not really sure.
96
return std::string("BeerXml MISC error: " + _err + "\n").c_str();
99
MiscException( std::string message )
104
~MiscException() throw() {}
113
bool operator()( Misc* lhs, Misc* rhs)
119
struct Misc_ptr_equals
121
bool operator()( Misc* lhs, Misc* rhs )