QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
nameslist.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 "pugixml/src/pugixml.hpp"
21
22#include <QtXml>
31class NamesList {
32 // constructors, destructor
33 public:
34 NamesList();
35 virtual ~NamesList();
36
37 // attributes
38 private:
39 QHash<QString, QString> hash_names;
40
41 public:
42 static int MetaTypeId;
43
44 // methods
45 public:
46 // methods relatives a la gestion de la liste
47 void addName(const QString &, const QString &);
48 void removeName(const QString &);
49 void clearNames();
50 QList<QString> langs() const;
51 bool isEmpty() const;
52 int count() const;
53 QString &operator[](const QString &);
54 const QString operator[](const QString &) const;
55 bool operator!=(const NamesList &) const;
56 bool operator==(const NamesList &) const;
57 QString name(const QString & = QString()) const;
58
59 // methods relatives a XML
60 void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>());
61 void fromXml(const pugi::xml_node &xml_element, const QHash<QString, QString> &xml_options = QHash<QString, QString>());
62 QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const;
63
64 protected:
65 QHash<QString, QString> getXmlOptions(const QHash<QString, QString> & = QHash<QString, QString>()) const;
66};
68#endif
Definition nameslist.h:31
int count() const
Definition nameslist.cpp:87
virtual ~NamesList()
Definition nameslist.cpp:35
QHash< QString, QString > hash_names
Definition nameslist.h:39
QString & operator[](const QString &)
Definition nameslist.cpp:97
QString name(const QString &=QString()) const
NamesList::name Return the adequate name regarding the current system locale. By order of preference,...
Definition nameslist.cpp:246
static int MetaTypeId
Definition nameslist.h:42
bool isEmpty() const
Definition nameslist.cpp:79
QDomElement toXml(QDomDocument &, const QHash< QString, QString > &=QHash< QString, QString >()) const
Definition nameslist.cpp:178
void clearNames()
Definition nameslist.cpp:63
bool operator==(const NamesList &) const
Definition nameslist.cpp:228
QList< QString > langs() const
Definition nameslist.cpp:71
void fromXml(const QDomElement &, const QHash< QString, QString > &=QHash< QString, QString >())
Definition nameslist.cpp:122
bool operator!=(const NamesList &) const
Definition nameslist.cpp:219
QHash< QString, QString > getXmlOptions(const QHash< QString, QString > &=QHash< QString, QString >()) const
Definition nameslist.cpp:200
void addName(const QString &, const QString &)
Definition nameslist.cpp:46
void removeName(const QString &)
Definition nameslist.cpp:56
NamesList()
Definition nameslist.cpp:28
Q_DECLARE_METATYPE(NamesList)