| 1 | /*************************************************************************** |
| 2 | grain.h |
| 3 | ------------------- |
| 4 | A grain 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 GRAIN_H |
| 34 | #define GRAIN_Hcxx . . $ `src/grain.h:34:9`! |
| 35 | |
| 36 | #include <QList> |
| 37 | #include <QMap> |
| 38 | #include <QStringList> |
| 39 | |
| 40 | #include "quantity.h"cxx . . $ `<file>/src/quantity.h`/ |
| 41 | |
| 42 | class Graincxx . . $ Grain# { |
| 43 | public: |
| 44 | // grain strings |
| 45 | static const QByteArraycxx . . $ QByteArray# EXTRACT_STRINGcxx . . $ Grain#EXTRACT_STRING.; |
| 46 | static const QByteArraycxx . . $ QByteArray# MASHED_STRINGcxx . . $ Grain#MASHED_STRING.; |
| 47 | static const QByteArraycxx . . $ QByteArray# STEEPED_STRINGcxx . . $ Grain#STEEPED_STRING.; |
| 48 | static const QByteArraycxx . . $ QByteArray# GRAIN_STRINGcxx . . $ Grain#GRAIN_STRING.; |
| 49 | static const QByteArraycxx . . $ QByteArray# ADJUNCT_STRINGcxx . . $ Grain#ADJUNCT_STRING.; |
| 50 | static const QByteArraycxx . . $ QByteArray# SUGAR_STRINGcxx . . $ Grain#SUGAR_STRING.; |
| 51 | static const QByteArraycxx . . $ QByteArray# OTHER_STRINGcxx . . $ Grain#OTHER_STRING.; |
| 52 | |
| 53 | // default constructor |
| 54 | Graincxx . . $ Grain#Grain(49f6e7a06ebc5aa8).(); |
| 55 | // constructor |
| 56 | Graincxx . . $ Grain#Grain(3be43a66133ffe7e).(const QStringcxx . . $ QString# &name, const Weightcxx . . $ Weight# &quantity, const double &extract, |
| 57 | const double &color, const QStringcxx . . $ QString# &typ, const QStringcxx . . $ QString# &use); |
| 58 | // copy constructor |
| 59 | Graincxx . . $ Grain#Grain(a6c84258c6f1c14e).(const Graincxx . . $ Grain# &g); |
| 60 | // operators |
| 61 | Graincxx . . $ Grain# operatorcxx . . $ Grain#`operator=`(7fead45929ea56fe).=(const Graincxx . . $ Grain# &g); |
| 62 | bool operatorcxx . . $ Grain#`operator==`(ca4418267d9a1f1d).==(const Graincxx . . $ Grain# &g) const; |
| 63 | bool operatorcxx . . $ Grain#`operator<`(ca4418267d9a1f1d).<(const Graincxx . . $ Grain# &g) const; |
| 64 | // destructor |
| 65 | ~cxx . . $ Grain#`~Grain`(ced63f7c635d850d).Graincxx . . $ Grain#(); |
| 66 | |
| 67 | // get/set name |
| 68 | const QStringcxx . . $ QString# &namecxx . . $ Grain#name(a2fb7a6ce195d51).() const; |
| 69 | void setNamecxx . . $ Grain#setName(3520e46b33348bf6).(const QStringcxx . . $ QString# &name); |
| 70 | // get/set weight |
| 71 | const Weightcxx . . $ Weight# &weightcxx . . $ Grain#weight(e805bc742de5fe4b).() const; |
| 72 | void setWeightcxx . . $ Grain#setWeight(fcd19e49ee58ab66).(const Weightcxx . . $ Weight# &weight); |
| 73 | // get/set extract |
| 74 | double extractcxx . . $ Grain#extract(21b6c25e127938e2).() const; |
| 75 | void setExtractcxx . . $ Grain#setExtract(ba8836b59fb42830).(double extract); |
| 76 | // get/set color |
| 77 | double colorcxx . . $ Grain#color(21b6c25e127938e2).() const; |
| 78 | void setColorcxx . . $ Grain#setColor(ba8836b59fb42830).(double color); |
| 79 | // get/set type |
| 80 | const QStringcxx . . $ QString# &typecxx . . $ Grain#type(a2fb7a6ce195d51).() const; |
| 81 | void setTypecxx . . $ Grain#setType(3520e46b33348bf6).(const QStringcxx . . $ QString# &typ); |
| 82 | // get/set usage |
| 83 | const QStringcxx . . $ QString# &usecxx . . $ Grain#use(a2fb7a6ce195d51).() const; |
| 84 | void setUsecxx . . $ Grain#setUse(3520e46b33348bf6).(const QStringcxx . . $ QString# &use); |
| 85 | |
| 86 | // return the yield (quantity times extract) |
| 87 | double yieldcxx . . $ Grain#yield(21b6c25e127938e2).() const; |
| 88 | // return the HCU (quantity times color) |
| 89 | double HCUcxx . . $ Grain#HCU(21b6c25e127938e2).() const; |
| 90 | |
| 91 | // return a list of use strings |
| 92 | static QStringListcxx . . $ QStringList# useStringListcxx . . $ Grain#useStringList(669a05bc42dd57cc).(); |
| 93 | // return a list of type strings |
| 94 | static QStringListcxx . . $ QStringList# typeStringListcxx . . $ Grain#typeStringList(669a05bc42dd57cc).(); |
| 95 | |
| 96 | private: |
| 97 | // recalc values |
| 98 | void recalccxx . . $ Grain#recalc(49f6e7a06ebc5aa8).(); |
| 99 | |
| 100 | private: |
| 101 | QStringcxx . . $ QString# name_cxx . . $ Grain#name_.; |
| 102 | Weightcxx . . $ Weight# weight_cxx . . $ Grain#weight_.; |
| 103 | double extract_cxx . . $ Grain#extract_.; |
| 104 | double color_cxx . . $ Grain#color_.; |
| 105 | QStringcxx . . $ QString# type_cxx . . $ Grain#type_.; |
| 106 | QStringcxx . . $ QString# use_cxx . . $ Grain#use_.; |
| 107 | double yield_cxx . . $ Grain#yield_.; |
| 108 | double hcu_cxx . . $ Grain#hcu_.; |
| 109 | }; |
| 110 | |
| 111 | typedef QListcxx . . $ QList#<Graincxx . . $ Grain#> GrainListcxx . . $ GrainList#; |
| 112 | typedef QMapcxx . . $ QMap#<QStringcxx . . $ QString#,Graincxx . . $ Grain#> GrainMapcxx . . $ GrainMap#; |
| 113 | |
| 114 | ////////////////////////////////////////////////////////////////////////////// |
| 115 | // Inlined Methods |
| 116 | |
| 117 | inline bool Graincxx . . $ Grain#::operatorcxx . . $ Grain#`operator<`(ca4418267d9a1f1d).<(const Graincxx . . $ Grain# &g) const |
| 118 | { return (name_cxx . . $ Grain#name_.<cxx . . $ `operator<`(5bc2975d2d751687).g.name_cxx . . $ Grain#name_.); } |
| 119 | |
| 120 | inline void Graincxx . . $ Grain#::setNamecxx . . $ Grain#setName(3520e46b33348bf6).(const QStringcxx . . $ QString# &name) |
| 121 | { name_cxx . . $ Grain#name_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). name; } |
| 122 | |
| 123 | inline const QStringcxx . . $ QString# &Graincxx . . $ Grain#::namecxx . . $ Grain#name(a2fb7a6ce195d51).() const |
| 124 | { return name_cxx . . $ Grain#name_.; } |
| 125 | |
| 126 | inline void Graincxx . . $ Grain#::setWeightcxx . . $ Grain#setWeight(fcd19e49ee58ab66).(const Weightcxx . . $ Weight# &weight) |
| 127 | { weight_cxx . . $ Grain#weight_. =cxx . . $ Weight#`operator=`(39a9bb3108e78fa6). weight; recalccxx . . $ Grain#recalc(49f6e7a06ebc5aa8).(); } |
| 128 | |
| 129 | inline const Weightcxx . . $ Weight# &Graincxx . . $ Grain#::weightcxx . . $ Grain#weight(e805bc742de5fe4b).() const |
| 130 | { return weight_cxx . . $ Grain#weight_.; } |
| 131 | |
| 132 | inline void Graincxx . . $ Grain#::setExtractcxx . . $ Grain#setExtract(ba8836b59fb42830).(double extract) |
| 133 | { extract_cxx . . $ Grain#extract_. = extract; recalccxx . . $ Grain#recalc(49f6e7a06ebc5aa8).(); } |
| 134 | |
| 135 | inline double Graincxx . . $ Grain#::extractcxx . . $ Grain#extract(21b6c25e127938e2).() const |
| 136 | { return extract_cxx . . $ Grain#extract_.; } |
| 137 | |
| 138 | inline void Graincxx . . $ Grain#::setColorcxx . . $ Grain#setColor(ba8836b59fb42830).(double color) |
| 139 | { color_cxx . . $ Grain#color_. = color; recalccxx . . $ Grain#recalc(49f6e7a06ebc5aa8).(); } |
| 140 | |
| 141 | inline double Graincxx . . $ Grain#::colorcxx . . $ Grain#color(21b6c25e127938e2).() const |
| 142 | { return color_cxx . . $ Grain#color_.; } |
| 143 | |
| 144 | inline void Graincxx . . $ Grain#::setTypecxx . . $ Grain#setType(3520e46b33348bf6).(const QStringcxx . . $ QString# &typ) |
| 145 | { type_cxx . . $ Grain#type_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). typ; } |
| 146 | |
| 147 | inline const QStringcxx . . $ QString# &Graincxx . . $ Grain#::typecxx . . $ Grain#type(a2fb7a6ce195d51).() const |
| 148 | { return type_cxx . . $ Grain#type_.; } |
| 149 | |
| 150 | inline void Graincxx . . $ Grain#::setUsecxx . . $ Grain#setUse(3520e46b33348bf6).(const QStringcxx . . $ QString# &use) |
| 151 | { use_cxx . . $ Grain#use_. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). use; } |
| 152 | |
| 153 | inline const QStringcxx . . $ QString# &Graincxx . . $ Grain#::usecxx . . $ Grain#use(a2fb7a6ce195d51).() const |
| 154 | { return use_cxx . . $ Grain#use_.; } |
| 155 | |
| 156 | inline double Graincxx . . $ Grain#::yieldcxx . . $ Grain#yield(21b6c25e127938e2).() const |
| 157 | { return yield_cxx . . $ Grain#yield_.; } |
| 158 | |
| 159 | inline double Graincxx . . $ Grain#::HCUcxx . . $ Grain#HCU(21b6c25e127938e2).() const |
| 160 | { return hcu_cxx . . $ Grain#hcu_.; } |
| 161 | |
| 162 | #endif // GRAIN_H |