| 1 | /*************************************************************************** |
| 2 | hop.h |
| 3 | ------------------- |
| 4 | A hop class |
| 5 | ------------------- |
| 6 | Copyright 1999-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 HOP_H |
| 34 | #define HOP_Hcxx . . $ `src/hop.h:34:9`! |
| 35 | |
| 36 | #include <QList> |
| 37 | #include <QMap> |
| 38 | #include <QString> |
| 39 | |
| 40 | #include "quantity.h"cxx . . $ `<file>/src/quantity.h`/ |
| 41 | |
| 42 | class Hopcxx . . $ Hop# { |
| 43 | public: |
| 44 | // hop strings |
| 45 | // TODO: make sure am comparing lowercase / handle lowercase, because old format uses it!!! |
| 46 | static const QByteArraycxx . . $ QByteArray# PELLET_STRINGcxx . . $ Hop#PELLET_STRING.; |
| 47 | static const QByteArraycxx . . $ QByteArray# PLUG_STRINGcxx . . $ Hop#PLUG_STRING.; |
| 48 | static const QByteArraycxx . . $ QByteArray# WHOLE_STRINGcxx . . $ Hop#WHOLE_STRING.; |
| 49 | |
| 50 | // default constructor |
| 51 | Hopcxx . . $ Hop#Hop(49f6e7a06ebc5aa8).(); |
| 52 | // full constructor |
| 53 | Hopcxx . . $ Hop#Hop(c3d816628ae0b20).(const QStringcxx . . $ QString# &name, const Weightcxx . . $ Weight# &weight, |
| 54 | const QStringcxx . . $ QString# &typ, const double &alpha, |
| 55 | const unsigned &time); |
| 56 | // copy constructor |
| 57 | Hopcxx . . $ Hop#Hop(1ff9fed636ba4a7f).(const Hopcxx . . $ Hop# &h); |
| 58 | // operators |
| 59 | Hopcxx . . $ Hop# operatorcxx . . $ Hop#`operator=`(a5d063c8d945c6bf).=(const Hopcxx . . $ Hop# &h); |
| 60 | bool operatorcxx . . $ Hop#`operator==`(a8a5c2d1f45d23cd).==(const Hopcxx . . $ Hop# &h) const; |
| 61 | bool operatorcxx . . $ Hop#`operator<`(a8a5c2d1f45d23cd).<(const Hopcxx . . $ Hop# &h) const; |
| 62 | // destructor |
| 63 | ~cxx . . $ Hop#`~Hop`(ced63f7c635d850d).Hopcxx . . $ Hop#(); |
| 64 | |
| 65 | // get/set name |
| 66 | const QStringcxx . . $ QString# &namecxx . . $ Hop#name(a2fb7a6ce195d51).() const; |
| 67 | void setNamecxx . . $ Hop#setName(3520e46b33348bf6).(const QStringcxx . . $ QString# &name); |
| 68 | // get/set weight |
| 69 | const Weightcxx . . $ Weight# &weightcxx . . $ Hop#weight(e805bc742de5fe4b).() const; |
| 70 | void setWeightcxx . . $ Hop#setWeight(fcd19e49ee58ab66).(const Weightcxx . . $ Weight# &weight); |
| 71 | // get/set alpha content |
| 72 | void setAlphacxx . . $ Hop#setAlpha(ba8836b59fb42830).(double alpha); |
| 73 | double alphacxx . . $ Hop#alpha(21b6c25e127938e2).() const; |
| 74 | //get/set boil time |
| 75 | unsigned timecxx . . $ Hop#time(ddd8539a2fcdd4ce).() const; |
| 76 | void setTimecxx . . $ Hop#setTime(cb2f890c2fdad230).(unsigned time); |
| 77 | // get/set type |
| 78 | const QStringcxx . . $ QString# &typecxx . . $ Hop#type(a2fb7a6ce195d51).() const; |
| 79 | void setTypecxx . . $ Hop#setType(3520e46b33348bf6).(const QStringcxx . . $ QString# &typ); |
| 80 | |
| 81 | // return precalculated value for bitterness |
| 82 | double HBUcxx . . $ Hop#HBU(31fa7155c10fdd13).(); |
| 83 | |
| 84 | // return hop type |
| 85 | static QStringListcxx . . $ QStringList# typeStringListcxx . . $ Hop#typeStringList(669a05bc42dd57cc).(); |
| 86 | |
| 87 | private: |
| 88 | // recalc values |
| 89 | void recalccxx . . $ Hop#recalc(49f6e7a06ebc5aa8).(); |
| 90 | |
| 91 | private: |
| 92 | QStringcxx . . $ QString# name_cxx . . $ Hop#name_.; |
| 93 | Weightcxx . . $ Weight# weight_cxx . . $ Hop#weight_.; |
| 94 | QStringcxx . . $ QString# type_cxx . . $ Hop#type_.; |
| 95 | double alpha_cxx . . $ Hop#alpha_.; |
| 96 | unsigned time_cxx . . $ Hop#time_.; |
| 97 | double hbu_cxx . . $ Hop#hbu_.; |
| 98 | }; |
| 99 | |
| 100 | typedef QListcxx . . $ QList#<Hopcxx . . $ Hop#> HopListcxx . . $ HopList#; |
| 101 | typedef QMapcxx . . $ QMap#<QStringcxx . . $ QString#,Hopcxx . . $ Hop#> HopMapcxx . . $ HopMap#; |
| 102 | |
| 103 | ////////////////////////////////////////////////////////////////////////////// |
| 104 | // Inlined Operators |
| 105 | |
| 106 | inline bool Hopcxx . . $ Hop#::operatorcxx . . $ Hop#`operator<`(a8a5c2d1f45d23cd).<(const Hopcxx . . $ Hop# &h) const |
| 107 | { return (name_cxx . . $ Hop#name_. <cxx . . $ `operator<`(5bc2975d2d751687). h.name_cxx . . $ Hop#name_.); } |
| 108 | |
| 109 | inline void Hopcxx . . $ Hop#::setNamecxx . . $ Hop#setName(3520e46b33348bf6).(const QStringcxx . . $ QString# &name) |
| 110 | { name_cxx . . $ Hop#name_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). name; } |
| 111 | |
| 112 | inline const QStringcxx . . $ QString# &Hopcxx . . $ Hop#::namecxx . . $ Hop#name(a2fb7a6ce195d51).() const |
| 113 | { return name_cxx . . $ Hop#name_.; } |
| 114 | |
| 115 | inline void Hopcxx . . $ Hop#::setWeightcxx . . $ Hop#setWeight(fcd19e49ee58ab66).(const Weightcxx . . $ Weight# &weight) |
| 116 | { weight_cxx . . $ Hop#weight_. =cxx . . $ Weight#`operator=`(39a9bb3108e78fa6). weight; recalccxx . . $ Hop#recalc(49f6e7a06ebc5aa8).(); } |
| 117 | |
| 118 | inline const Weightcxx . . $ Weight# &Hopcxx . . $ Hop#::weightcxx . . $ Hop#weight(e805bc742de5fe4b).() const |
| 119 | { return weight_cxx . . $ Hop#weight_.; } |
| 120 | |
| 121 | inline void Hopcxx . . $ Hop#::setTypecxx . . $ Hop#setType(3520e46b33348bf6).(const QStringcxx . . $ QString# &typ) |
| 122 | { type_cxx . . $ Hop#type_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). typ; } |
| 123 | |
| 124 | inline const QStringcxx . . $ QString# &Hopcxx . . $ Hop#::typecxx . . $ Hop#type(a2fb7a6ce195d51).() const |
| 125 | { return type_cxx . . $ Hop#type_.; } |
| 126 | |
| 127 | inline void Hopcxx . . $ Hop#::setAlphacxx . . $ Hop#setAlpha(ba8836b59fb42830).(double alpha) |
| 128 | { alpha_cxx . . $ Hop#alpha_. = alpha; recalccxx . . $ Hop#recalc(49f6e7a06ebc5aa8).(); } |
| 129 | |
| 130 | inline double Hopcxx . . $ Hop#::alphacxx . . $ Hop#alpha(21b6c25e127938e2).() const |
| 131 | { return alpha_cxx . . $ Hop#alpha_.; } |
| 132 | |
| 133 | inline void Hopcxx . . $ Hop#::setTimecxx . . $ Hop#setTime(cb2f890c2fdad230).(unsigned time) |
| 134 | { time_cxx . . $ Hop#time_. = time; } |
| 135 | |
| 136 | inline unsigned Hopcxx . . $ Hop#::timecxx . . $ Hop#time(ddd8539a2fcdd4ce).() const |
| 137 | { return time_cxx . . $ Hop#time_.; } |
| 138 | |
| 139 | inline double Hopcxx . . $ Hop#::HBUcxx . . $ Hop#HBU(31fa7155c10fdd13).() |
| 140 | { return hbu_cxx . . $ Hop#hbu_.; } |
| 141 | |
| 142 | #endif // HOP_H |