libquentier  0.5.0
The library for rich desktop clients of Evernote service
User.h
1 /*
2  * Copyright 2016-2020 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/types/ErrorString.h>
23 #include <quentier/utility/Printable.h>
24 
25 #include <qt5qevercloud/QEverCloud.h>
26 
27 #include <QtGlobal>
28 
29 namespace quentier {
30 
31 QT_FORWARD_DECLARE_CLASS(UserData)
32 
33 class QUENTIER_EXPORT User: public Printable
34 {
35 public:
36  using PrivilegeLevel = qevercloud::PrivilegeLevel;
37  using ServiceLevel = qevercloud::ServiceLevel;
38 
39 public:
40  explicit User();
41  explicit User(const qevercloud::User & user);
42  explicit User(qevercloud::User && user);
43  User(const User & other);
44  User(User && other);
45  User & operator=(const User & other);
46  User & operator=(User && other);
47  virtual ~User() override;
48 
49  bool operator==(const User & other) const;
50  bool operator!=(const User & other) const;
51 
52  const qevercloud::User & qevercloudUser() const;
53  qevercloud::User & qevercloudUser();
54 
55  void clear();
56 
57  bool isDirty() const;
58  void setDirty(const bool dirty);
59 
60  bool isLocal() const;
61  void setLocal(const bool local);
62 
63  bool checkParameters(ErrorString & errorDescription) const;
64 
65  bool hasId() const;
66  qint32 id() const;
67  void setId(const qint32 id);
68 
69  bool hasUsername() const;
70  const QString & username() const;
71  void setUsername(const QString & username);
72 
73  bool hasEmail() const;
74  const QString & email() const;
75  void setEmail(const QString & email);
76 
77  bool hasName() const;
78  const QString & name() const;
79  void setName(const QString & name);
80 
81  bool hasTimezone() const;
82  const QString & timezone() const;
83  void setTimezone(const QString & timezone);
84 
85  bool hasPrivilegeLevel() const;
86  PrivilegeLevel privilegeLevel() const;
87  void setPrivilegeLevel(const qint8 level);
88 
89  bool hasServiceLevel() const;
90  ServiceLevel serviceLevel() const;
91  void setServiceLevel(const qint8 level);
92 
93  bool hasCreationTimestamp() const;
94  qint64 creationTimestamp() const;
95  void setCreationTimestamp(const qint64 timestamp);
96 
97  bool hasModificationTimestamp() const;
98  qint64 modificationTimestamp() const;
99  void setModificationTimestamp(const qint64 timestamp);
100 
101  bool hasDeletionTimestamp() const;
102  qint64 deletionTimestamp() const;
103  void setDeletionTimestamp(const qint64 timestamp);
104 
105  bool hasActive() const;
106  bool active() const;
107  void setActive(const bool active);
108 
109  bool hasShardId() const;
110  const QString & shardId() const;
111  void setShardId(const QString & shardId);
112 
113  bool hasUserAttributes() const;
114  const qevercloud::UserAttributes & userAttributes() const;
115  void setUserAttributes(qevercloud::UserAttributes && attributes);
116 
117  bool hasAccounting() const;
118  const qevercloud::Accounting & accounting() const;
119  void setAccounting(qevercloud::Accounting && accounting);
120 
121  bool hasBusinessUserInfo() const;
122  const qevercloud::BusinessUserInfo & businessUserInfo() const;
123  void setBusinessUserInfo(qevercloud::BusinessUserInfo && info);
124 
125  bool hasPhotoUrl() const;
126  QString photoUrl() const;
127  void setPhotoUrl(const QString & photoUrl);
128 
129  bool hasPhotoLastUpdateTimestamp() const;
130  qint64 photoLastUpdateTimestamp() const;
131  void setPhotoLastUpdateTimestamp(const qint64 timestamp);
132 
133  bool hasAccountLimits() const;
134  const qevercloud::AccountLimits & accountLimits() const;
135  void setAccountLimits(qevercloud::AccountLimits && limits);
136 
137  virtual QTextStream & print(QTextStream & strm) const override;
138 
139  friend class Notebook;
140 
141 private:
142  QSharedDataPointer<UserData> d;
143 };
144 
145 } // namespace quentier
146 
147 #endif // LIB_QUENTIER_TYPES_USER_H
quentier::Printable
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:39
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
quentier::Notebook
Definition: Notebook.h:35
quentier::User
Definition: User.h:34