Debian Codegraph @

src/recipe.h

raw symbols SCIP
1 /***************************************************************************
2 recipe.h
3 -------------------
4 Recipe (document) class
5 -------------------
6 Copyright 2001-2008, David Johnson
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 2. Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ***************************************************************************/
32
33 #ifndef RECIPE_H
34 #define RECIPE_Hcxx . . $ `src/recipe.h:34:9`!
35
36 #include <QObject>
37 #include <QString>
38
39 #include "quantity.h"cxx . . $ `<file>/src/quantity.h`/
40 #include "grain.h"cxx . . $ `<file>/src/grain.h`/
41 #include "hop.h"cxx . . $ `<file>/src/hop.h`/
42 #include "misc.h"cxx . . $ `<file>/src/misc.h`/
43 #include "style.h"cxx . . $ `<file>/src/style.h`/
44
45 class TextPrintercxx . . $ TextPrinter#;
46
47 class Recipecxx . . $ Recipe# : public QObjectcxx . . $ QObject# {
48 Q_OBJECTcxx . . $ Recipe#tr(75d9f1c324b4579d).
49 public:
50 // TODO: make sure am comparing lowercase
51 // recipe strings
52 static const QByteArraycxx . . $ QByteArray# EXTRACT_STRINGcxx . . $ Recipe#EXTRACT_STRING.;
53 static const QByteArraycxx . . $ QByteArray# PARTIAL_STRINGcxx . . $ Recipe#PARTIAL_STRING.;
54 static const QByteArraycxx . . $ QByteArray# ALLGRAIN_STRINGcxx . . $ Recipe#ALLGRAIN_STRING.;
55
56 // default constructor
57 Recipecxx . . $ Recipe#Recipe(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent=0);
58 Recipecxx . . $ Recipe#Recipe(894f235acc26e914).(const Recipecxx . . $ Recipe# &recipe);
59 Recipecxx . . $ Recipe# operatorcxx . . $ Recipe#`operator=`(1061f923ca6c467f).=(const Recipecxx . . $ Recipe# &recipe);
60 virtual ~cxx . . $ Recipe#`~Recipe`(ced63f7c635d850d).Recipecxx . . $ Recipe#();
61
62 // start a new recipe
63 void newRecipecxx . . $ Recipe#newRecipe(49f6e7a06ebc5aa8).();
64 // load a recipe
65 bool loadRecipecxx . . $ Recipe#loadRecipe(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
66 // save the current recipe
67 bool saveRecipecxx . . $ Recipe#saveRecipe(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
68 // preview the recipe
69 void previewRecipecxx . . $ Recipe#previewRecipe(79329d6b37ebd6ba).(TextPrintercxx . . $ TextPrinter# *textprinter);
70 // print the recipe
71 void printRecipecxx . . $ Recipe#printRecipe(79329d6b37ebd6ba).(TextPrintercxx . . $ TextPrinter# *textprinter);
72 // is the file in native format?
73 bool nativeFormatcxx . . $ Recipe#nativeFormat(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
74 // is the file in BeerXml format?
75 bool beerXmlFormatcxx . . $ Recipe#beerXmlFormat(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
76
77 // import a recipe from another BeerXML format
78 bool importBeerXmlcxx . . $ Recipe#importBeerXml(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
79 // export the recipe as html
80 bool exportHtmlcxx . . $ Recipe#exportHtml(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
81 // export the recipe to BeerXML format
82 bool exportBeerXMLcxx . . $ Recipe#exportBeerXML(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
83 // export the recipe as pdf
84 bool exportPdfcxx . . $ Recipe#exportPdf(fbad90219c7ca024).(TextPrintercxx . . $ TextPrinter# *textprinter, const QStringcxx . . $ QString# &filename);
85 // export the recipe as html
86 bool exportTextcxx . . $ Recipe#exportText(e1defb592416720d).(const QStringcxx . . $ QString# &filename);
87
88 // get and set
89 const QStringcxx . . $ QString#& titlecxx . . $ Recipe#title(a2fb7a6ce195d51).() const;
90 void setTitlecxx . . $ Recipe#setTitle(3520e46b33348bf6).(const QStringcxx . . $ QString# &t);
91 const QStringcxx . . $ QString#& brewercxx . . $ Recipe#brewer(a2fb7a6ce195d51).() const;
92 void setBrewercxx . . $ Recipe#setBrewer(3520e46b33348bf6).(const QStringcxx . . $ QString# &b);
93 const Volumecxx . . $ Volume# &sizecxx . . $ Recipe#size(72d6f2be71f69f8b).() const;
94 void setSizecxx . . $ Recipe#setSize(c63af3d33c27c499).(const Volumecxx . . $ Volume# &s);
95 const Stylecxx . . $ Style# &stylecxx . . $ Recipe#style(c446394d65978504).() const;
96 void setStylecxx . . $ Recipe#setStyle(29d9cc28be3d2322).(const Stylecxx . . $ Style# &s);
97 void setStylecxx . . $ Recipe#setStyle(3520e46b33348bf6).(const QStringcxx . . $ QString# &s);
98 const QStringcxx . . $ QString#& recipeNotescxx . . $ Recipe#recipeNotes(a2fb7a6ce195d51).() const;
99 void setRecipeNotescxx . . $ Recipe#setRecipeNotes(3520e46b33348bf6).(const QStringcxx . . $ QString# &n);
100 const QStringcxx . . $ QString#& batchNotescxx . . $ Recipe#batchNotes(a2fb7a6ce195d51).() const;
101 void setBatchNotescxx . . $ Recipe#setBatchNotes(3520e46b33348bf6).(const QStringcxx . . $ QString# &n);
102
103 // add an ingredient to the recipe
104 void addGraincxx . . $ Recipe#addGrain(a6c84258c6f1c14e).(const Graincxx . . $ Grain# &g);
105 void addHopcxx . . $ Recipe#addHop(1ff9fed636ba4a7f).(const Hopcxx . . $ Hop# &h);
106 void addMisccxx . . $ Recipe#addMisc(9f5928fef634771).(const Misccxx . . $ Misc# &m);
107
108 // return pointer to ingredient lists
109 GrainListcxx . . $ GrainList# *grainscxx . . $ Recipe#grains(82afbf80a5444d7a).();
110 HopListcxx . . $ HopList# *hopscxx . . $ Recipe#hops(2886401ee1ad17db).();
111 MiscListcxx . . $ MiscList# *miscscxx . . $ Recipe#miscs(ac04078a324f9929).();
112
113 // return original gravity
114 double OGcxx . . $ Recipe#OG(31fa7155c10fdd13).();
115 // return bitterness
116 int IBUcxx . . $ Recipe#IBU(b126dc7c1de90089).();
117 // return color
118 int SRMcxx . . $ Recipe#SRM(b126dc7c1de90089).();
119 // return estimated final gravity
120 double FGEstimatecxx . . $ Recipe#FGEstimate(31fa7155c10fdd13).();
121 // return method of recipe
122 QStringcxx . . $ QString# methodcxx . . $ Recipe#method(4365c3963150523e).();
123
124 // return alcohol %v
125 double ABVcxx . . $ Recipe#ABV(31fa7155c10fdd13).();
126 static double ABVcxx . . $ Recipe#ABV(d8e7e0733fa41c87).(double og, double fg);
127 // return alcohol %w
128 double ABWcxx . . $ Recipe#ABW(31fa7155c10fdd13).();
129 static double ABWcxx . . $ Recipe#ABW(d8e7e0733fa41c87).(double og, double fg);
130 // convert Specific Gravity to Plato
131 static double SgToPcxx . . $ Recipe#SgToP(447c67c6676f75c3).(double sg);
132 // convert grain extract to yield
133 static double extractToYieldcxx . . $ Recipe#extractToYield(447c67c6676f75c3).(double extract);
134 static double yieldToExtractcxx . . $ Recipe#yieldToExtract(447c67c6676f75c3).(double yield);
135
136 // is the recipe modified?
137 bool modifiedcxx . . $ Recipe#modified(50ce9a9e25b4a850).() const;
138
139 public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
140 // recalculate the recipe values
141 void recalccxx . . $ Recipe#recalc(49f6e7a06ebc5aa8).();
142 // set recipe as modified
143 void setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(bool m);
144
145 signalscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:89:14`!:
146 // send that the recipe has been loaded or created
147 void recipeChangedcxx . . $ Recipe#recipeChanged(49f6e7a06ebc5aa8).();
148 // send that the recipe has been modified
149 void recipeModifiedcxx . . $ Recipe#recipeModified(49f6e7a06ebc5aa8).();
150
151 private:
152 // calculations
153 double calcOGcxx . . $ Recipe#calcOG(31fa7155c10fdd13).();
154 int calcSRMcxx . . $ Recipe#calcSRM(b126dc7c1de90089).();
155 int calcIBUcxx . . $ Recipe#calcIBU(b126dc7c1de90089).();
156 int calcRagerIBUcxx . . $ Recipe#calcRagerIBU(b126dc7c1de90089).();
157 int calcTinsethIBUcxx . . $ Recipe#calcTinsethIBU(b126dc7c1de90089).();
158
159 const QStringcxx . . $ QString# recipeHTMLcxx . . $ Recipe#recipeHTML(ea4b39313763ec41).();
160 const QStringcxx . . $ QString# recipeTextcxx . . $ Recipe#recipeText(ea4b39313763ec41).();
161
162 private:
163 bool modified_cxx . . $ Recipe#modified_.;
164
165 QStringcxx . . $ QString# title_cxx . . $ Recipe#title_.;
166 QStringcxx . . $ QString# brewer_cxx . . $ Recipe#brewer_.;
167
168 Volumecxx . . $ Volume# size_cxx . . $ Recipe#size_.;
169 Stylecxx . . $ Style# style_cxx . . $ Recipe#style_.;
170
171 GrainListcxx . . $ GrainList# grains_cxx . . $ Recipe#grains_.;
172 HopListcxx . . $ HopList# hops_cxx . . $ Recipe#hops_.;
173 MiscListcxx . . $ MiscList# miscs_cxx . . $ Recipe#miscs_.;
174
175 QStringcxx . . $ QString# recipenotes_cxx . . $ Recipe#recipenotes_.;
176 QStringcxx . . $ QString# batchnotes_cxx . . $ Recipe#batchnotes_.;
177
178 double og_cxx . . $ Recipe#og_.;
179 int ibu_cxx . . $ Recipe#ibu_.;
180 int srm_cxx . . $ Recipe#srm_.;
181 };
182
183 // Inlined Methods //////////////////////////////////////////////////////////
184
185 inline const QStringcxx . . $ QString# &Recipecxx . . $ Recipe#::titlecxx . . $ Recipe#title(a2fb7a6ce195d51).() const
186 { return title_cxx . . $ Recipe#title_.; }
187
188 inline void Recipecxx . . $ Recipe#::setTitlecxx . . $ Recipe#setTitle(3520e46b33348bf6).(const QStringcxx . . $ QString# &t)
189 { title_cxx . . $ Recipe#title_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). t; setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
190
191 inline const QStringcxx . . $ QString# &Recipecxx . . $ Recipe#::brewercxx . . $ Recipe#brewer(a2fb7a6ce195d51).() const
192 { return brewer_cxx . . $ Recipe#brewer_.; }
193
194 inline void Recipecxx . . $ Recipe#::setBrewercxx . . $ Recipe#setBrewer(3520e46b33348bf6).(const QStringcxx . . $ QString# &b)
195 { brewer_cxx . . $ Recipe#brewer_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). b; setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
196
197 inline const Volumecxx . . $ Volume# &Recipecxx . . $ Recipe#::sizecxx . . $ Recipe#size(72d6f2be71f69f8b).() const
198 { return size_cxx . . $ Recipe#size_.; }
199
200 inline void Recipecxx . . $ Recipe#::setSizecxx . . $ Recipe#setSize(c63af3d33c27c499).(const Volumecxx . . $ Volume# &s)
201 { size_cxx . . $ Recipe#size_. =cxx . . $ Volume#`operator=`(dbe4f9802804587b). s; recalccxx . . $ Recipe#recalc(49f6e7a06ebc5aa8).(); setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
202
203 inline const Stylecxx . . $ Style# &Recipecxx . . $ Recipe#::stylecxx . . $ Recipe#style(c446394d65978504).() const
204 { return style_cxx . . $ Recipe#style_.; }
205
206 inline void Recipecxx . . $ Recipe#::setStylecxx . . $ Recipe#setStyle(29d9cc28be3d2322).(const Stylecxx . . $ Style# &s)
207 { style_cxx . . $ Recipe#style_. =cxx . . $ Style#`operator=`(73c14b8dd1039aa8). s; setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
208
209 inline const QStringcxx . . $ QString#& Recipecxx . . $ Recipe#::recipeNotescxx . . $ Recipe#recipeNotes(a2fb7a6ce195d51).() const
210 { return recipenotes_cxx . . $ Recipe#recipenotes_.; }
211
212 inline void Recipecxx . . $ Recipe#::setRecipeNotescxx . . $ Recipe#setRecipeNotes(3520e46b33348bf6).(const QStringcxx . . $ QString# &n)
213 { recipenotes_cxx . . $ Recipe#recipenotes_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). n; setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
214
215 inline const QStringcxx . . $ QString#& Recipecxx . . $ Recipe#::batchNotescxx . . $ Recipe#batchNotes(a2fb7a6ce195d51).() const
216 { return batchnotes_cxx . . $ Recipe#batchnotes_.; }
217
218 inline void Recipecxx . . $ Recipe#::setBatchNotescxx . . $ Recipe#setBatchNotes(3520e46b33348bf6).(const QStringcxx . . $ QString# &n)
219 { batchnotes_cxx . . $ Recipe#batchnotes_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). n; setModifiedcxx . . $ Recipe#setModified(b45ddcbc8423892c).(true); }
220
221 inline GrainListcxx . . $ GrainList# *Recipecxx . . $ Recipe#::grainscxx . . $ Recipe#grains(82afbf80a5444d7a).() { return &grains_cxx . . $ Recipe#grains_.; }
222
223 inline HopListcxx . . $ HopList# *Recipecxx . . $ Recipe#::hopscxx . . $ Recipe#hops(2886401ee1ad17db).() { return &hops_cxx . . $ Recipe#hops_.; }
224
225 inline MiscListcxx . . $ MiscList# *Recipecxx . . $ Recipe#::miscscxx . . $ Recipe#miscs(ac04078a324f9929).() { return &miscs_cxx . . $ Recipe#miscs_.; }
226
227 inline double Recipecxx . . $ Recipe#::OGcxx . . $ Recipe#OG(31fa7155c10fdd13).() { return og_cxx . . $ Recipe#og_.; }
228
229 inline int Recipecxx . . $ Recipe#::IBUcxx . . $ Recipe#IBU(b126dc7c1de90089).() { return ibu_cxx . . $ Recipe#ibu_.; }
230
231 inline int Recipecxx . . $ Recipe#::SRMcxx . . $ Recipe#SRM(b126dc7c1de90089).() { return srm_cxx . . $ Recipe#srm_.; }
232
233 #endif // RECIPE_H