libquentier  0.4.0
The library for rich desktop clients of Evernote service
Resource.h
1 /*
2  * Copyright 2016 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();
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() Q_DECL_OVERRIDE;
52 
53  virtual bool hasGuid() const Q_DECL_OVERRIDE;
54  virtual const QString & guid() const Q_DECL_OVERRIDE;
55  virtual void setGuid(const QString & guid) Q_DECL_OVERRIDE;
56 
57  virtual bool hasUpdateSequenceNumber() const Q_DECL_OVERRIDE;
58  virtual qint32 updateSequenceNumber() const Q_DECL_OVERRIDE;
59  virtual void setUpdateSequenceNumber(const qint32 updateSequenceNumber) Q_DECL_OVERRIDE;
60 
61  virtual bool checkParameters(ErrorString & errorDescription) const Q_DECL_OVERRIDE;
62 
63  QString displayName() const;
64  void setDisplayName(const QString & displayName);
65 
66  QString preferredFileSuffix() const;
67 
68  int indexInNote() const;
69  void setIndexInNote(const int index);
70 
71  bool hasNoteGuid() const;
72  const QString & noteGuid() const;
73  void setNoteGuid(const QString & guid);
74 
75  bool hasNoteLocalUid() const;
76  const QString & noteLocalUid() const;
77  void setNoteLocalUid(const QString & guid);
78 
79  bool hasData() const;
80 
81  bool hasDataHash() const;
82  const QByteArray & dataHash() const;
83  void setDataHash(const QByteArray & hash);
84 
85  bool hasDataSize() const;
86  qint32 dataSize() const;
87  void setDataSize(const qint32 size);
88 
89  bool hasDataBody() const;
90  const QByteArray & dataBody() const;
91  void setDataBody(const QByteArray & body);
92 
93  bool hasMime() const;
94  const QString & mime() const;
95  void setMime(const QString & mime);
96 
97  bool hasWidth() const;
98  qint16 width() const;
99  void setWidth(const qint16 width);
100 
101  bool hasHeight() const;
102  qint16 height() const;
103  void setHeight(const qint16 height);
104 
105  bool hasRecognitionData() const;
106 
107  bool hasRecognitionDataHash() const;
108  const QByteArray & recognitionDataHash() const;
109  void setRecognitionDataHash(const QByteArray & hash);
110 
111  bool hasRecognitionDataSize() const;
112  qint32 recognitionDataSize() const;
113  void setRecognitionDataSize(const qint32 size);
114 
115  bool hasRecognitionDataBody() const;
116  const QByteArray & recognitionDataBody() const;
117  void setRecognitionDataBody(const QByteArray & body);
118 
119  bool hasAlternateData() const;
120 
121  bool hasAlternateDataHash() const;
122  const QByteArray & alternateDataHash() const;
123  void setAlternateDataHash(const QByteArray & hash);
124 
125  bool hasAlternateDataSize() const;
126  qint32 alternateDataSize() const;
127  void setAlternateDataSize(const qint32 size);
128 
129  bool hasAlternateDataBody() const;
130  const QByteArray & alternateDataBody() const;
131  void setAlternateDataBody(const QByteArray & body);
132 
133  bool hasResourceAttributes() const;
134  const qevercloud::ResourceAttributes & resourceAttributes() const;
135  qevercloud::ResourceAttributes & resourceAttributes();
136  void setResourceAttributes(const qevercloud::ResourceAttributes & attributes);
137  void setResourceAttributes(qevercloud::ResourceAttributes && attributes);
138 
139  friend class Note;
140 
141  virtual QTextStream & print(QTextStream & strm) const Q_DECL_OVERRIDE;
142 
143 private:
144  QSharedDataPointer<ResourceData> d;
145 };
146 
147 } // namespace quentier
148 
149 #endif // LIB_QUENTIER_TYPES_RESOURCE_H
Definition: INoteStoreDataElement.h:30
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:38
Definition: Resource.h:29
Definition: Note.h:38