Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 81 lines (62 sloc) 2.331 kB
418ce8a @gnuvince initial commit
authored
1 /*
2 * usager.h
3 * Copyright (C) 2011 Nicolas Martin, Université de Montréal
4 *
5 * This program 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 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef USAGER_H
20 #define USAGER_H
21
22 #include <QObject>
23 #include <QDateTime>
24 #include <QVariant>
25 #include <QStringList>
26 #include "geoposition.h"
27
28 class UsagerModel;
29
30 class Usager : public QObject
31 {
32 Q_OBJECT
33 public:
34 enum Colonnes { COL_ID, COL_NOM, COL_POS, COL_PERSO };
35
36 public:
37 explicit Usager(QString nom, GeoPosition pos, QObject *parent = 0);
38
39 virtual QVariant field(uint column, int role) const;
40 virtual bool changeField(uint column, QVariant value);
41
42 qint64 getId() const { return id; }
43
44 QString getNom() const { return nom; }
45 void setNom(const QString &nom) { if (!nom.isNull()) this->nom = nom; }
46
47 GeoPosition getPosition() const { return position; }
48 void setPosition(const GeoPosition &position) { if (position.isValid()) this->position = position; }
49
50 static uint headerCount();
51 static QVariant header(uint column);
52
53 private:
54 static qint64 idCount;
55 qint64 id;
56
57 signals:
58
59 public slots:
60
61 protected:
62 QString nom;
63 GeoPosition position;
64
65 static QStringList& headers();
66
67 private:
68 friend QDataStream& operator<<(QDataStream& ds, const Usager &pos);
69 friend QDataStream& operator>>(QDataStream& ds, Usager &pos);
70 friend QDataStream& operator<<(QDataStream& ds, const UsagerModel &pos);
71 friend QDataStream& operator>>(QDataStream& ds, UsagerModel &pos);
72 //pour le déserialisateur seulement ...
73 Usager(QObject *parent=0) : QObject(parent) {}
74 Usager(const Usager &n);
75 };
76
77 QDataStream& operator<<(QDataStream& ds, const Usager &pos);
78 QDataStream& operator>>(QDataStream& ds, Usager &pos);
79
80 #endif // USAGER_H
Something went wrong with that request. Please try again.