1 /***************************************************************************
2 style.h
3 -------------------
4 AHA-like style 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 STYLE_H
34 #define STYLE_H
35
36 #include <QList>
37 #include <QMap>
38 #include <QString>
39
40 class Style {
41 public:
42 // default constructor
43 Style();
44 // constructor
45 Style(const QString name, const double &oglow, const double &oghi,
46 const double &fglow, const double &fghi, const int &ibulow,
47 const int &ibuhi, const int &srmlow, const int &srmhi);
48 // copy constructor
49 Style(const Style &s);
50 // operators
51 Style operator=(const Style &s);
52 bool operator==(const Style &s) const;
53 bool operator<(const Style &s) const;
54 // destructor
55 ~Style();
56
57 // return name of style
58 const QString &name() const;
59 void setName(const QString &name);
60 // return high end of OG
61 double OGHi() const;
62 void setOGHi(double hi);
63 // return low end of OG
64 double OGLow() const;
65 void setOGLow(double lo);
66 // return high end of FG
67 double FGHi() const;
68 void setFGHi(double hi);
69 // return low end of FG
70 double FGLow() const;
71 void setFGLow(double lo);
72 // return high end of IBU
73 int IBUHi() const;
74 void setIBUHi(int hi);
75 // return low end of IBU
76 int IBULow() const;
77 void setIBULow(int lo);
78 // return high end of SRM
79 int SRMHi() const;
80 void setSRMHi(int hi);
81 // return low end of SRM
82 int SRMLow() const;
83 void setSRMLow(int lo);
84
85 private:
86 friend class StyleModel;
87
88 QString name_;
89 double oglow_;
90 double oghi_;
91 double fglow_;
92 double fghi_;
93 int ibulow_;
94 int ibuhi_;
95 int srmlow_;
96 int srmhi_;
97 };
98
99 typedef QList<Style> StyleList;
100 typedef QMap<QString,Style> StyleMap;
101
102 //////////////////////////////////////////////////////////////////////////////
103 // Inlined Methods
104
105 inline bool Style::operator<(const Style &s) const { return (name_<s.name_); }
106
name()107 inline const QString &Style::name() const { return name_; }
108
setName(const QString & name)109 inline void Style::setName(const QString &name) { name_ = name; }
110
OGHi()111 inline double Style::OGHi() const { return oghi_; }
setOGHi(double hi)112 inline void Style::setOGHi(double hi) { oghi_ = hi; }
113
OGLow()114 inline double Style::OGLow() const { return oglow_; }
setOGLow(double lo)115 inline void Style::setOGLow(double lo) { oglow_ = lo; }
116
FGHi()117 inline double Style::FGHi() const { return fghi_; }
setFGHi(double hi)118 inline void Style::setFGHi(double hi) { fghi_ = hi; }
119
FGLow()120 inline double Style::FGLow() const { return fglow_; }
setFGLow(double lo)121 inline void Style::setFGLow(double lo) { fglow_ = lo; }
122
IBUHi()123 inline int Style::IBUHi() const { return ibuhi_; }
setIBUHi(int hi)124 inline void Style::setIBUHi(int hi) { ibuhi_ = hi; }
125
IBULow()126 inline int Style::IBULow() const { return ibulow_; }
setIBULow(int lo)127 inline void Style::setIBULow(int lo) { ibulow_ = lo; }
128
SRMHi()129 inline int Style::SRMHi() const { return srmhi_; }
setSRMHi(int hi)130 inline void Style::setSRMHi(int hi) { srmhi_ = hi; }
131
SRMLow()132 inline int Style::SRMLow() const { return srmlow_; }
setSRMLow(int lo)133 inline void Style::setSRMLow(int lo) { srmlow_ = lo; }
134
135 #endif // STYLE_H
136