File: misc.cpp

package info (click to toggle)
qbrew 0.4.1-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 1,724 kB
  • ctags: 1,355
  • sloc: cpp: 7,503; sh: 414; makefile: 18
file content (94 lines) | stat: -rw-r--r-- 2,706 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/***************************************************************************
  misc.cpp
  -------------------
  A generic ingredient class
  -------------------
  Copyright 1999-2008, David Johnson
  Please see the header file for copyright and license information
 ***************************************************************************/

#include <QStringList>
#include "resource.h"
#include "misc.h"

using namespace Resource;

const QByteArray Misc::YEAST_STRING    = QT_TRANSLATE_NOOP("misc", "Yeast");
const QByteArray Misc::FINING_STRING   = QT_TRANSLATE_NOOP("misc", "Fining");
const QByteArray Misc::HERB_STRING     = QT_TRANSLATE_NOOP("misc", "Herb");
const QByteArray Misc::SPICE_STRING    = QT_TRANSLATE_NOOP("misc", "Spice");
const QByteArray Misc::FLAVOR_STRING   = QT_TRANSLATE_NOOP("misc", "Flavor");
const QByteArray Misc::ADDITIVE_STRING = QT_TRANSLATE_NOOP("misc", "Additive");
const QByteArray Misc::OTHER_STRING    = QT_TRANSLATE_NOOP("misc", "Other");

//////////////////////////////////////////////////////////////////////////////
// Misc()
// ------
// constructor

Misc::Misc()
    : name_(QObject::tr("Generic")), quantity_(), type_(OTHER_STRING), notes_()
{ ; }

Misc::Misc(const QString &name, const Quantity &quantity, const QString &typ,
           const QString &notes)
    : name_(name), quantity_(quantity),  type_(typ),
      notes_(notes)
{ ; }

Misc::~Misc() { ; }

//////////////////////////////////////////////////////////////////////////////
// Misc()
// ------
// copy constructor

Misc::Misc(const Misc &m)
    : name_(m.name_), quantity_(m.quantity_), type_(m.type_), notes_(m.notes_)
{ ; }

//////////////////////////////////////////////////////////////////////////////
// operator=()
// -----------
// Assignment operator

Misc Misc::operator=(const Misc &m)
{
    if (this != &m) {
        name_ = m.name_;
        quantity_ = m.quantity_;
        type_ = m.type_;
        notes_ = m.notes_;
    }
    return *this;
}

//////////////////////////////////////////////////////////////////////////////
// operator==()
// -----------
// Equivalence operator

bool Misc::operator==(const Misc &m) const
{
    return (name_ == m.name_)
        && (quantity_ == m.quantity_)
        && (type_ == m.type_)
        && (notes_ == m.notes_);
}

///////////////////////////////////////////////////////////////////////////////
// typeStringList()
// ----------------
// Return string list of misc types

QStringList Misc::typeStringList()
{
    return (QStringList()
            << YEAST_STRING
            << FINING_STRING
            << HERB_STRING
            << SPICE_STRING
            << FLAVOR_STRING
            << ADDITIVE_STRING
            << OTHER_STRING);
}