Code clean-up added code blocks for headers and added QJson related lines to src.pro
[situare] / src / user / user.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Henri Lampela - henri.lampela@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef USER_H
23 #define USER_H
24
25 #include <QPointF>
26 #include <QString>
27 #include <QUrl>
28
29 /**
30 * @brief Class to store user information (applies to friends also)
31 *
32 * @author Henri Lampela
33 * @class User user.h "user/user.h"
34 */
35 class User
36 {
37 public:
38
39     /**
40     * @brief Default constructor, initializes member data
41     *
42     */
43     User(const QString address, const QPointF coordinates, const QString name, const QString note,
44          const QUrl imageUrl, const QString timestamp, const bool type, const QString userId,
45          const QString units = 0, const double value = 0);
46
47     /*******************************************************************************
48      * MEMBER FUNCTIONS AND SLOTS
49      ******************************************************************************/
50
51     /**
52     * @brief Set address
53     *
54     * @param address street address
55     */
56     void setAddress(const QString &address);
57
58     /**
59     * @brief Set coordinates ( x = lon, y = lat )
60     *
61     * @param coordinates coordinates
62     */
63     void setCoordinates(const QPointF &coordinates);
64
65     /**
66     * @brief Set distance
67     *
68     * @param value distance
69     * @param units unit type
70     */
71     void setDistance(const double &value, const QString &units);
72
73     /**
74     * @brief Set note
75     *
76     * @param note note/status message
77     */
78     void setNote(const QString &note);
79
80     /**
81     * @brief Set download address for profile image
82     *
83     * @param imageUrl image url
84     */
85     void setProfileImageUrl(const QUrl &imageUrl);
86
87     /**
88     * @brief Set timestamp for last status update, timestamp is in literal mode
89     *
90     * @param timestamp timestamp
91     */
92     void setTimestamp(const QString &timestamp);
93
94     /**
95     * @brief Get address
96     *
97     * @return QString address
98     */
99     QString address() const;
100
101     /**
102     * @brief Get coordinates
103     *
104     * @return QPointF coordinates
105     */
106     QPointF coordinates() const;
107
108     /**
109     * @brief Get distance and units
110     *
111     * @param value distance
112     * @param units unit type
113     */
114     void distance(double &value, QString &units) const;
115
116     /**
117     * @brief Get name
118     *
119     * @return QString profile name
120     */
121     QString name() const;
122
123     /**
124     * @brief Get note/status message
125     *
126     * @return QString note
127     */
128     QString note() const;
129
130     /**
131     * @brief Get download address for profile image
132     *
133     * @return QString url
134     */
135     QUrl profileImageUrl() const;
136
137     /**
138     * @brief Get timestamp of last status update
139     *
140     * @return QString timestamp
141     */
142     QString timestamp() const;
143
144     /**
145     * @brief Get user type
146     *
147     * @return bool user type (true = user, false = friend)
148     */
149     bool type() const;
150
151     /**
152     * @brief Get userId
153     *
154     * @return QString userId
155     */
156     QString userId() const;
157
158     /*******************************************************************************
159      * DATA MEMBERS
160      ******************************************************************************/
161
162 private:
163     QString m_address; ///< placeholder for address information
164     QPointF m_coordinates; ///< placeholder for coordinates
165     QString m_name; ///< placeholder for name
166     QString m_note; ///< placeholder for note
167     QUrl m_profileImageUrl; ///< placeholder for image url
168     QString m_timestamp; ///< placeholer for timestamp
169     bool m_type; ///< placeholder for user type
170     QString m_units; ///< placeholder for distance unit type
171     QString m_userId; ///< placeholder for userId
172     double m_value; ///< placeholder for distance value
173 };
174
175
176 #endif // USER_H