libquentier  0.5.0
The library for rich desktop clients of Evernote service
Account.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_ACCOUNT_H
20 #define LIB_QUENTIER_TYPES_ACCOUNT_H
21 
22 #include <quentier/utility/Macros.h>
23 #include <quentier/utility/Printable.h>
24 
25 #include <qt5qevercloud/QEverCloud.h>
26 
27 #include <QSharedDataPointer>
28 #include <QString>
29 
30 namespace quentier {
31 
32 QT_FORWARD_DECLARE_CLASS(AccountData)
33 
34 
39 class QUENTIER_EXPORT Account: public Printable
40 {
41 public:
42  enum class Type
43  {
44  Local = 0,
45  Evernote
46  };
47 
48  friend QUENTIER_EXPORT QTextStream & operator<<(
49  QTextStream & strm, const Type type);
50 
51  friend QUENTIER_EXPORT QDebug & operator<<(QDebug & dbg, const Type type);
52 
53  enum class EvernoteAccountType
54  {
55  Free = 0,
56  Plus,
57  Premium,
58  Business
59  };
60 
61  friend QUENTIER_EXPORT QTextStream & operator<<(
62  QTextStream & strm, const EvernoteAccountType type);
63 
64  friend QUENTIER_EXPORT QDebug & operator<<(
65  QDebug & dbg, const EvernoteAccountType type);
66 
67 public:
68  explicit Account();
69 
70  explicit Account(
71  QString name, const Type type,
72  const qevercloud::UserID userId = -1,
73  const EvernoteAccountType evernoteAccountType =
74  EvernoteAccountType::Free,
75  QString evernoteHost = {},
76  QString shardId = {});
77 
78  Account(const Account & other);
79  Account & operator=(const Account & other);
80  virtual ~Account() override;
81 
82  bool operator==(const Account & other) const;
83  bool operator!=(const Account & other) const;
84 
90  bool isEmpty() const;
91 
95  QString name() const;
96 
100  void setName(QString name);
101 
107  QString displayName() const;
108 
112  void setDisplayName(QString displayName);
113 
117  Type type() const;
118 
124  qevercloud::UserID id() const;
125 
130  EvernoteAccountType evernoteAccountType() const;
131 
136  QString evernoteHost() const;
137 
143  QString shardId() const;
144 
145  void setEvernoteAccountType(const EvernoteAccountType evernoteAccountType);
146  void setEvernoteHost(QString evernoteHost);
147  void setShardId(QString shardId);
148 
149  qint32 mailLimitDaily() const;
150  qint64 noteSizeMax() const;
151  qint64 resourceSizeMax() const;
152  qint32 linkedNotebookMax() const;
153  qint32 noteCountMax() const;
154  qint32 notebookCountMax() const;
155  qint32 tagCountMax() const;
156  qint32 noteTagCountMax() const;
157  qint32 savedSearchCountMax() const;
158  qint32 noteResourceCountMax() const;
159  void setEvernoteAccountLimits(const qevercloud::AccountLimits & limits);
160 
161  virtual QTextStream & print(QTextStream & strm) const override;
162 
163 private:
164  QSharedDataPointer<AccountData> d;
165 };
166 
167 } // namespace quentier
168 
169 #endif // LIB_QUENTIER_TYPES_ACCOUNT_H
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition: Account.h:40
void setName(QString name)
setName sets the username to the account
void setDisplayName(QString displayName)
qevercloud::UserID id() const
Type type() const
EvernoteAccountType evernoteAccountType() const
bool isEmpty() const
QString displayName() const
QString shardId() const
QString evernoteHost() const
QString name() const
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:39