QElectroTech  0.70
nameslist.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef NAMES_LIST_H
19 #define NAMES_LIST_H
20 #include <QtXml>
29 class NamesList {
30  // constructors, destructor
31  public:
32  NamesList();
33  NamesList(const NamesList &);
34  virtual ~NamesList();
35 
36  // attributes
37  private:
38  QHash<QString, QString> hash_names;
39 
40  public:
41  static int MetaTypeId;
42 
43  // methods
44  public:
45  // methods relatives a la gestion de la liste
46  void addName(const QString &, const QString &);
47  void removeName(const QString &);
48  void clearNames();
49  QList<QString> langs() const;
50  bool isEmpty() const;
51  int count() const;
52  QString &operator[](const QString &);
53  const QString operator[](const QString &) const;
54  bool operator!=(const NamesList &) const;
55  bool operator==(const NamesList &) const;
56  QString name(const QString & = QString()) const;
57 
58  // methods relatives a XML
59  void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>());
60  QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const;
61 
62  protected:
63  QHash<QString, QString> getXmlOptions(const QHash<QString, QString> & = QHash<QString, QString>()) const;
64 };
66 #endif
QString & operator[](const QString &)
Definition: nameslist.cpp:96
void fromXml(const QDomElement &, const QHash< QString, QString > &=QHash< QString, QString >())
Definition: nameslist.cpp:120
QHash< QString, QString > hash_names
Definition: nameslist.h:38
QString name(const QString &=QString()) const
Definition: nameslist.cpp:205
QDomElement toXml(QDomDocument &, const QHash< QString, QString > &=QHash< QString, QString >()) const
Definition: nameslist.cpp:143
void addName(const QString &, const QString &)
Definition: nameslist.cpp:50
static int MetaTypeId
Definition: nameslist.h:41
virtual ~NamesList()
Definition: nameslist.cpp:40
void removeName(const QString &)
Definition: nameslist.cpp:59
bool isEmpty() const
Definition: nameslist.cpp:80
QHash< QString, QString > getXmlOptions(const QHash< QString, QString > &=QHash< QString, QString >()) const
Definition: nameslist.cpp:164
bool operator==(const NamesList &) const
Definition: nameslist.cpp:190
int count() const
Definition: nameslist.cpp:87
bool operator!=(const NamesList &) const
Definition: nameslist.cpp:182
Q_DECLARE_METATYPE(NamesList)
void clearNames()
Definition: nameslist.cpp:66
QList< QString > langs() const
Definition: nameslist.cpp:73