2
* fermentable.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/>.
19
#ifndef _FERMENTABLE_H
20
#define _FERMENTABLE_H
25
#include "observable.h"
27
#include "BeerXMLElement.h"
31
class Fermentable : public Observable, public BeerXMLElement
35
Fermentable( Fermentable& other );
36
Fermentable( const XmlNode* node );
37
Fermentable(const QDomNode& fermentableNode);
39
virtual void toXml(QDomDocument& doc, QDomNode& parent); // From BeerXMLElement
40
//std::string toXml();
43
friend bool operator<(Fermentable &f1, Fermentable &f2);
44
friend bool operator==(Fermentable &f1, Fermentable &f2);
47
const std::string& getName() const;
48
int getVersion() const;
49
const std::string& getType() const;
50
double getAmount_kg() const;
51
double getYield_pct() const;
52
double getColor_srm() const;
54
bool getAddAfterBoil() const;
55
const std::string& getOrigin() const;
56
const std::string& getSupplier() const;
57
const std::string& getNotes() const;
58
double getCoarseFineDiff_pct() const;
59
double getMoisture_pct() const;
60
double getDiastaticPower_lintner() const;
61
double getProtein_pct() const;
62
double getMaxInBatch_pct() const;
63
bool getRecommendMash() const;
64
double getIbuGalPerLb() const;
68
// Get the maximum kg of equivalent sucrose that will come out of this ferm.
69
double getEquivSucrose_kg() const;
72
void setName( const std::string& str );
73
void setVersion( int num );
74
void setType( const std::string& str );
75
void setAmount_kg( double num );
76
void setYield_pct( double num );
77
void setColor_srm( double num );
79
void setAddAfterBoil( bool b );
80
void setOrigin( const std::string& str );
81
void setSupplier( const std::string& str);
82
void setNotes( const std::string& str );
83
void setCoarseFineDiff_pct( double num );
84
void setMoisture_pct( double num );
85
void setDiastaticPower_lintner( double num );
86
void setProtein_pct( double num );
87
void setMaxInBatch_pct( double num );
88
void setRecommendMash( bool b );
89
void setIbuGalPerLb( double num );
91
/*** My extensions ***/
92
bool getIsMashed() const;
93
void setIsMashed(bool var);
94
/*** END my extensions ***/
98
static const int version = 1;
106
std::string supplier;
108
double coarseFineDiff_pct;
110
double diastaticPower_lintner;
112
double maxInBatch_pct;
115
/*** My extensions ***/
117
/*** END my extensions ***/
119
static bool isValidType( const std::string& str );
123
class FermentableException : public std::exception
127
virtual const char* what() const throw()
129
// Note: this temporary object might get destroyed too early.
130
// I'm not really sure.
131
return std::string("BeerXml FERMENTABLE error: " + _err + "\n").c_str();
134
FermentableException( std::string message )
139
~FermentableException() throw() {}
146
struct Fermentable_ptr_cmp
148
bool operator()( Fermentable* lhs, Fermentable* rhs)
154
struct Fermentable_ptr_equals
156
bool operator()( Fermentable* lhs, Fermentable* rhs )