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