libquentier  0.5.0
The library for rich desktop clients of Evernote service
Resource.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_RESOURCE_H
20 #define LIB_QUENTIER_TYPES_RESOURCE_H
21 
22 #include "INoteStoreDataElement.h"
23 #include "Note.h"
24 
25 namespace quentier {
26 
27 QT_FORWARD_DECLARE_CLASS(ResourceData)
28 
29 class QUENTIER_EXPORT Resource: public INoteStoreDataElement
30 {
31 public:
32  QN_DECLARE_LOCAL_UID
33  QN_DECLARE_DIRTY
34  QN_DECLARE_LOCAL
35 
36 public:
37  explicit Resource();
38  Resource(const Resource & other);
39  Resource(Resource && other);
40  explicit Resource(const qevercloud::Resource & resource);
41  Resource & operator=(const Resource & other);
42  Resource & operator=(Resource && other);
43  virtual ~Resource() override;
44 
45  bool operator==(const Resource & other) const;
46  bool operator!=(const Resource & other) const;
47 
48  const qevercloud::Resource & qevercloudResource() const;
49  qevercloud::Resource & qevercloudResource();
50 
51  virtual void clear() override;
52 
53  virtual bool hasGuid() const override;
54  virtual const QString & guid() const override;
55  virtual void setGuid(const QString & guid) override;
56 
57  virtual bool hasUpdateSequenceNumber() const override;
58  virtual qint32 updateSequenceNumber() const override;
59 
60  virtual void setUpdateSequenceNumber(
61  const qint32 updateSequenceNumber) override;
62 
63  virtual bool checkParameters(ErrorString & errorDescription) const override;
64 
65  QString displayName() const;
66  void setDisplayName(const QString & displayName);
67 
68  QString preferredFileSuffix() const;
69 
70  int indexInNote() const;
71  void setIndexInNote(const int index);
72 
73  bool hasNoteGuid() const;
74  const QString & noteGuid() const;
75  void setNoteGuid(const QString & guid);
76 
77  bool hasNoteLocalUid() const;
78  const QString & noteLocalUid() const;
79  void setNoteLocalUid(const QString & guid);
80 
81  bool hasData() const;
82 
83  bool hasDataHash() const;
84  const QByteArray & dataHash() const;
85  void setDataHash(const QByteArray & hash);
86 
87  bool hasDataSize() const;
88  qint32 dataSize() const;
89  void setDataSize(const qint32 size);
90 
91  bool hasDataBody() const;
92  const QByteArray & dataBody() const;
93  void setDataBody(const QByteArray & body);
94 
95  bool hasMime() const;
96  const QString & mime() const;
97  void setMime(const QString & mime);
98 
99  bool hasWidth() const;
100  qint16 width() const;
101  void setWidth(const qint16 width);
102 
103  bool hasHeight() const;
104  qint16 height() const;
105  void setHeight(const qint16 height);
106 
107  bool hasRecognitionData() const;
108 
109  bool hasRecognitionDataHash() const;
110  const QByteArray & recognitionDataHash() const;
111  void setRecognitionDataHash(const QByteArray & hash);
112 
113  bool hasRecognitionDataSize() const;
114  qint32 recognitionDataSize() const;
115  void setRecognitionDataSize(const qint32 size);
116 
117  bool hasRecognitionDataBody() const;
118  const QByteArray & recognitionDataBody() const;
119  void setRecognitionDataBody(const QByteArray & body);
120 
121  bool hasAlternateData() const;
122 
123  bool hasAlternateDataHash() const;
124  const QByteArray & alternateDataHash() const;
125  void setAlternateDataHash(const QByteArray & hash);
126 
127  bool hasAlternateDataSize() const;
128  qint32 alternateDataSize() const;
129  void setAlternateDataSize(const qint32 size);
130 
131  bool hasAlternateDataBody() const;
132  const QByteArray & alternateDataBody() const;
133  void setAlternateDataBody(const QByteArray & body);
134 
135  bool hasResourceAttributes() const;
136  const qevercloud::ResourceAttributes & resourceAttributes() const;
137  qevercloud::ResourceAttributes & resourceAttributes();
138 
139  void setResourceAttributes(
140  const qevercloud::ResourceAttributes & attributes);
141 
142  void setResourceAttributes(qevercloud::ResourceAttributes && attributes);
143 
144  friend class Note;
145 
146  virtual QTextStream & print(QTextStream & strm) const override;
147 
148 private:
149  QSharedDataPointer<ResourceData> d;
150 };
151 
152 } // namespace quentier
153 
154 #endif // LIB_QUENTIER_TYPES_RESOURCE_H
quentier::INoteStoreDataElement
Definition: INoteStoreDataElement.h:35
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
quentier::Resource
Definition: Resource.h:30
quentier::Note
Definition: Note.h:35