libquentier  0.4.0
The library for rich desktop clients of Evernote service
User.h
1 /*
2  * Copyright 2016 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier 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 Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_TYPES_USER_H
20 #define LIB_QUENTIER_TYPES_USER_H
21 
22 #include <quentier/utility/Printable.h>
23 #include <quentier/types/ErrorString.h>
24 
25 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
26 #include <qt5qevercloud/QEverCloud.h>
27 #else
28 #include <qt4qevercloud/QEverCloud.h>
29 #endif
30 
31 #include <QtGlobal>
32 
33 namespace quentier {
34 
35 QT_FORWARD_DECLARE_CLASS(UserData)
36 
37 class QUENTIER_EXPORT User: public Printable
38 {
39 public:
40  typedef qevercloud::PrivilegeLevel::type PrivilegeLevel;
41  typedef qevercloud::ServiceLevel::type ServiceLevel;
42 
43 public:
44  explicit User();
45  explicit User(const qevercloud::User & user);
46  explicit User(qevercloud::User && user);
47  User(const User & other);
48  User(User && other);
49  User & operator=(const User & other);
50  User & operator=(User && other);
51  virtual ~User();
52 
53  bool operator==(const User & other) const;
54  bool operator!=(const User & other) const;
55 
56  const qevercloud::User & qevercloudUser() const;
57  qevercloud::User & qevercloudUser();
58 
59  void clear();
60 
61  bool isDirty() const;
62  void setDirty(const bool dirty);
63 
64  bool isLocal() const;
65  void setLocal(const bool local);
66 
67  bool checkParameters(ErrorString & errorDescription) const;
68 
69  bool hasId() const;
70  qint32 id() const;
71  void setId(const qint32 id);
72 
73  bool hasUsername() const;
74  const QString & username() const;
75  void setUsername(const QString & username);
76 
77  bool hasEmail() const;
78  const QString & email() const;
79  void setEmail(const QString & email);
80 
81  bool hasName() const;
82  const QString & name() const;
83  void setName(const QString & name);
84 
85  bool hasTimezone() const;
86  const QString & timezone() const;
87  void setTimezone(const QString & timezone);
88 
89  bool hasPrivilegeLevel() const;
90  PrivilegeLevel privilegeLevel() const;
91  void setPrivilegeLevel(const qint8 level);
92 
93  bool hasServiceLevel() const;
94  ServiceLevel serviceLevel() const;
95  void setServiceLevel(const qint8 level);
96 
97  bool hasCreationTimestamp() const;
98  qint64 creationTimestamp() const;
99  void setCreationTimestamp(const qint64 timestamp);
100 
101  bool hasModificationTimestamp() const;
102  qint64 modificationTimestamp() const;
103  void setModificationTimestamp(const qint64 timestamp);
104 
105  bool hasDeletionTimestamp() const;
106  qint64 deletionTimestamp() const;
107  void setDeletionTimestamp(const qint64 timestamp);
108 
109  bool hasActive() const;
110  bool active() const;
111  void setActive(const bool active);
112 
113  bool hasShardId() const;
114  const QString & shardId() const;
115  void setShardId(const QString & shardId);
116 
117  bool hasUserAttributes() const;
118  const qevercloud::UserAttributes & userAttributes() const;
119  void setUserAttributes(qevercloud::UserAttributes && attributes);
120 
121  bool hasAccounting() const;
122  const qevercloud::Accounting & accounting() const;
123  void setAccounting(qevercloud::Accounting && accounting);
124 
125  bool hasBusinessUserInfo() const;
126  const qevercloud::BusinessUserInfo & businessUserInfo() const;
127  void setBusinessUserInfo(qevercloud::BusinessUserInfo && info);
128 
129  bool hasPhotoUrl() const;
130  QString photoUrl() const;
131  void setPhotoUrl(const QString & photoUrl);
132 
133  bool hasPhotoLastUpdateTimestamp() const;
134  qint64 photoLastUpdateTimestamp() const;
135  void setPhotoLastUpdateTimestamp(const qint64 timestamp);
136 
137  bool hasAccountLimits() const;
138  const qevercloud::AccountLimits & accountLimits() const;
139  void setAccountLimits(qevercloud::AccountLimits && limits);
140 
141  virtual QTextStream & print(QTextStream & strm) const Q_DECL_OVERRIDE;
142 
143  friend class Notebook;
144 
145 private:
146  QSharedDataPointer<UserData> d;
147 };
148 
149 } // namespace quentier
150 
151 #endif // LIB_QUENTIER_TYPES_USER_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:38
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:54
Definition: Notebook.h:38
Definition: User.h:37