1
/***************************************************************************
2
* Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18
***************************************************************************/
20
#ifndef KALZIUMNUMERATIONTYPE_H
21
#define KALZIUMNUMERATIONTYPE_H
23
class KalziumNumerationType;
26
#include <QStringList>
29
* Factory for KalziumNumerationType classes.
31
* @author Pino Toscano
33
class KalziumNumerationTypeFactory
37
* Get the instance of this factory.
39
static KalziumNumerationTypeFactory* instance();
42
* Returns the KalziumNumerationType with the @p id specified.
43
* It will gives 0 if none found.
45
KalziumNumerationType* build ( int id ) const;
47
* Returns the KalziumNumerationType whose name is the @p id
49
* It will gives 0 if none found.
51
KalziumNumerationType* build ( const QByteArray& id ) const;
54
* Returns a list with the names of the numeration types we
57
QStringList numerations() const;
60
KalziumNumerationTypeFactory();
62
QList<KalziumNumerationType*> m_numerations;
66
* Base class for a numeration type.
67
* It's quite simple, as a numeration doesn't have many data to represent.
69
* @author Pino Toscano
71
class KalziumNumerationType
77
static KalziumNumerationType* instance();
79
virtual ~KalziumNumerationType();
82
* Returns the ID of this numeration type.
83
* Mainly used when saving/loading.
85
virtual QByteArray name() const = 0;
87
* Returns the description of this numeration type.
88
* Used in all the visible places.
90
virtual QString description() const = 0;
93
* Returns the @p num 'th item of this numeration type.
95
virtual QString item ( const int num ) const;
97
* Returns all the items of this numeration type.
99
virtual QStringList items() const;
102
KalziumNumerationType();
108
* The class representing no numeration.
109
* This could look a bit weird, but this way makes quite modular even disabling
112
* @author Pino Toscano
114
class KalziumNoneNumerationType : public KalziumNumerationType
117
static KalziumNoneNumerationType* instance();
119
QByteArray name() const;
120
QString description() const;
122
QString item ( const int num ) const;
123
QStringList items() const;
126
KalziumNoneNumerationType();
130
* The numeration "International Union of Pure and Applied Chemistry" (IUPAC).
132
* @author Pino Toscano
134
class KalziumIUPACNumerationType : public KalziumNumerationType
137
static KalziumIUPACNumerationType* instance();
139
QByteArray name() const;
140
QString description() const;
143
KalziumIUPACNumerationType();
147
* The numeration "Chemical Abstract Service" (CAS).
149
* @author Pino Toscano
151
class KalziumCASNumerationType : public KalziumNumerationType
154
static KalziumCASNumerationType* instance();
156
QByteArray name() const;
157
QString description() const;
160
KalziumCASNumerationType();
164
* The old IUPAC numeration.
166
* @author Pino Toscano
168
class KalziumOldIUPACNumerationType : public KalziumNumerationType
171
static KalziumOldIUPACNumerationType* instance();
173
QByteArray name() const;
174
QString description() const;
177
KalziumOldIUPACNumerationType();
180
#endif // KALZIUMNUMERATIONTYPE_H