2
* yeast.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/>.
25
#include "observable.h"
26
#include "BeerXMLElement.h"
32
class Yeast : public Observable, public BeerXMLElement
37
Yeast( XmlNode *node );
38
Yeast( const QDomNode& yeastNode );
40
friend bool operator<(Yeast &y1, Yeast &y2);
41
friend bool operator==(Yeast &y1, Yeast &y2);
43
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 setForm( const std::string& var );
51
void setAmount( double var );
52
void setAmountIsWeight( bool var );
53
void setLaboratory( const std::string& var );
54
void setProductID( const std::string& var );
55
void setMinTemperature_c( double var );
56
void setMaxTemperature_c( double var );
57
void setFlocculation( const std::string& var );
58
void setAttenuation_pct( double var );
59
void setNotes( const std::string& var );
60
void setBestFor( const std::string& var );
61
void setTimesCultured( int var );
62
void setMaxReuse( int var );
63
void setAddToSecondary( bool var );
66
std::string getName() const;
67
std::string getType() const;
68
std::string getForm() const;
69
double getAmount() const;
70
bool getAmountIsWeight() const;
71
std::string getLaboratory() const;
72
std::string getProductID() const;
73
double getMinTemperature_c() const;
74
double getMaxTemperature_c() const;
75
std::string getFlocculation() const;
76
double getAttenuation_pct() const;
77
std::string getNotes() const;
78
std::string getBestFor() const;
79
int getTimesCultured() const;
80
int getMaxReuse() const;
81
bool getAddToSecondary() const;
86
static const int version = 1;
93
std::string laboratory;
94
std::string productID;
95
double minTemperature_c;
96
double maxTemperature_c;
97
std::string flocculation;
98
double attenuation_pct;
106
bool isValidType(const std::string& str) const;
107
bool isValidForm(const std::string& str) const;
108
bool isValidFlocculation(const std::string& str) const;
112
class YeastException : public std::exception
116
virtual const char* what() const throw()
118
// Note: this temporary object might get destroyed too early.
119
// I'm not really sure.
120
return std::string("BeerXml YEAST error: " + _err + "\n").c_str();
123
YeastException( std::string message )
128
~YeastException() throw() {}
137
bool operator()( Yeast* lhs, Yeast* rhs)
143
struct Yeast_ptr_equals
145
bool operator()( Yeast* lhs, Yeast* rhs )
151
#endif /* _YEAST_H */