2007-12-01 10:47:15 +00:00
|
|
|
/*
|
2014-01-29 18:37:45 +00:00
|
|
|
Copyright 2006-2014 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2007-04-13 15:48:00 +00:00
|
|
|
#ifndef NAMES_LIST_H
|
|
|
|
#define NAMES_LIST_H
|
|
|
|
#include <QtXml>
|
2007-10-10 17:50:26 +00:00
|
|
|
/**
|
|
|
|
Cette classe represente une liste de noms, utilisee
|
|
|
|
par les elements et categories pour embarquer un meme nom en plusieurs
|
|
|
|
langues.
|
|
|
|
Les langues sont representees par deux lettres (typiquement : les deux
|
|
|
|
premieres de la locale du systeme) ; exemples : en pour l'anglais, fr
|
|
|
|
pour le francais.
|
|
|
|
*/
|
2007-04-13 15:48:00 +00:00
|
|
|
class NamesList {
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2007-04-13 15:48:00 +00:00
|
|
|
public:
|
|
|
|
NamesList();
|
|
|
|
NamesList(const NamesList &);
|
|
|
|
virtual ~NamesList();
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2007-04-13 15:48:00 +00:00
|
|
|
private:
|
|
|
|
QHash<QString, QString> hash_names;
|
|
|
|
|
2011-12-23 17:41:16 +00:00
|
|
|
public:
|
|
|
|
static int MetaTypeId;
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2007-04-13 15:48:00 +00:00
|
|
|
public:
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods relatives a la gestion de la liste
|
2007-04-13 15:48:00 +00:00
|
|
|
void addName(const QString &, const QString &);
|
|
|
|
void removeName(const QString &);
|
|
|
|
void clearNames();
|
|
|
|
QList<QString> langs() const;
|
|
|
|
bool isEmpty() const;
|
|
|
|
int count() const;
|
|
|
|
QString &operator[](const QString &);
|
|
|
|
const QString operator[](const QString &) const;
|
2007-09-10 21:50:17 +00:00
|
|
|
bool operator!=(const NamesList &) const;
|
|
|
|
bool operator==(const NamesList &) const;
|
2007-11-04 17:37:10 +00:00
|
|
|
QString name(const QString & = QString()) const;
|
2007-04-13 15:48:00 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods relatives a XML
|
2011-05-25 14:09:47 +00:00
|
|
|
void fromXml(const QDomElement &, const QHash<QString, QString> & = QHash<QString, QString>());
|
|
|
|
QDomElement toXml(QDomDocument &, const QHash<QString, QString> & = QHash<QString, QString>()) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QHash<QString, QString> getXmlOptions(const QHash<QString, QString> & = QHash<QString, QString>()) const;
|
2007-04-13 15:48:00 +00:00
|
|
|
};
|
2011-12-23 17:41:16 +00:00
|
|
|
Q_DECLARE_METATYPE(NamesList);
|
2007-04-13 15:48:00 +00:00
|
|
|
#endif
|