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/Printable.h>
23 
24 #include <qt5qevercloud/QEverCloud.h>
25 
26 #include <QSharedDataPointer>
27 #include <QString>
28 
29 namespace quentier {
30 
31 QT_FORWARD_DECLARE_CLASS(AccountData)
32 
33 
38 class QUENTIER_EXPORT Account : public Printable
39 {
40 public:
41  enum class Type
42  {
43  Local = 0,
44  Evernote
45  };
46 
47  friend QUENTIER_EXPORT QTextStream & operator<<(
48  QTextStream & strm, const Type type);
49 
50  friend QUENTIER_EXPORT QDebug & operator<<(QDebug & dbg, const Type type);
51 
52  enum class EvernoteAccountType
53  {
54  Free = 0,
55  Plus,
56  Premium,
57  Business
58  };
59 
60  friend QUENTIER_EXPORT QTextStream & operator<<(
61  QTextStream & strm, const EvernoteAccountType type);
62 
63  friend QUENTIER_EXPORT QDebug & operator<<(
64  QDebug & dbg, const EvernoteAccountType type);
65 
66 public:
67  explicit Account();
68 
69  explicit Account(
70  QString name, const Type type, const qevercloud::UserID userId = -1,
71  const EvernoteAccountType evernoteAccountType =
72  EvernoteAccountType::Free,
73  QString evernoteHost = {}, QString shardId = {});
74 
75  Account(const Account & other);
76  Account & operator=(const Account & other);
77  virtual ~Account() override;
78 
79  bool operator==(const Account & other) const;
80  bool operator!=(const Account & other) const;
81 
87  bool isEmpty() const;
88 
92  QString name() const;
93 
97  void setName(QString name);
98 
104  QString displayName() const;
105 
109  void setDisplayName(QString displayName);
110 
114  Type type() const;
115 
121  qevercloud::UserID id() const;
122 
127  EvernoteAccountType evernoteAccountType() const;
128 
133  QString evernoteHost() const;
134 
140  QString shardId() const;
141 
142  void setEvernoteAccountType(const EvernoteAccountType evernoteAccountType);
143  void setEvernoteHost(QString evernoteHost);
144  void setShardId(QString shardId);
145 
146  qint32 mailLimitDaily() const;
147  qint64 noteSizeMax() const;
148  qint64 resourceSizeMax() const;
149  qint32 linkedNotebookMax() const;
150  qint32 noteCountMax() const;
151  qint32 notebookCountMax() const;
152  qint32 tagCountMax() const;
153  qint32 noteTagCountMax() const;
154  qint32 savedSearchCountMax() const;
155  qint32 noteResourceCountMax() const;
156  void setEvernoteAccountLimits(const qevercloud::AccountLimits & limits);
157 
158  virtual QTextStream & print(QTextStream & strm) const override;
159 
160 private:
161  QSharedDataPointer<AccountData> d;
162 };
163 
164 } // namespace quentier
165 
166 #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:39
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:38