libquentier  0.8.0
The library for rich desktop clients of Evernote service
ResourceRecognitionIndexItem.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/Linkage.h>
22 #include <quentier/utility/Printable.h>
23 
24 #include <QByteArray>
25 #include <QList>
26 #include <QSharedDataPointer>
27 
28 #include <memory>
29 
30 namespace quentier {
31 
32 class ResourceRecognitionIndexItemData;
33 
34 class QUENTIER_EXPORT ResourceRecognitionIndexItem : public utility::Printable
35 {
36 public:
38 
40 
42  ResourceRecognitionIndexItem && other) noexcept;
43 
44  ResourceRecognitionIndexItem & operator=(
45  const ResourceRecognitionIndexItem & other);
46 
47  ResourceRecognitionIndexItem & operator=(
48  ResourceRecognitionIndexItem && other) noexcept;
49 
50  ~ResourceRecognitionIndexItem() override;
51 
52  [[nodiscard]] bool isValid() const;
53 
54  [[nodiscard]] int x() const;
55  void setX(int x);
56 
57  [[nodiscard]] int y() const;
58  void setY(int y);
59 
60  [[nodiscard]] int h() const;
61  void setH(int h);
62 
63  [[nodiscard]] int w() const;
64  void setW(int w);
65 
66  [[nodiscard]] int offset() const;
67  void setOffset(int offset);
68 
69  [[nodiscard]] int duration() const;
70  void setDuration(int duration);
71 
72  [[nodiscard]] QList<int> strokes() const;
73  void setStrokes(QList<int> strokes);
74 
75  struct QUENTIER_EXPORT ITextItem
76  {
77  virtual ~ITextItem();
78 
79  [[nodiscard]] virtual QString text() const = 0;
80  [[nodiscard]] virtual int weight() const = 0;
81  };
82 
83  using ITextItemPtr = std::shared_ptr<ITextItem>;
84 
85  [[nodiscard]] QList<ITextItemPtr> textItems() const;
86  void setTextItems(QList<ITextItemPtr> textItems);
87 
88  struct QUENTIER_EXPORT IObjectItem
89  {
90  virtual ~IObjectItem();
91 
92  [[nodiscard]] virtual QString objectType() const = 0;
93  [[nodiscard]] virtual int weight() const = 0;
94  };
95 
96  using IObjectItemPtr = std::shared_ptr<IObjectItem>;
97 
98  [[nodiscard]] QList<IObjectItemPtr> objectItems() const;
99  void setObjectItems(QList<IObjectItemPtr> objectItems);
100 
101  struct QUENTIER_EXPORT IShapeItem
102  {
103  virtual ~IShapeItem();
104 
105  [[nodiscard]] virtual QString shape() const = 0;
106  [[nodiscard]] virtual int weight() const = 0;
107  };
108 
109  using IShapeItemPtr = std::shared_ptr<IShapeItem>;
110 
111  [[nodiscard]] QList<IShapeItemPtr> shapeItems() const;
112  void setShapeItems(QList<IShapeItemPtr> shapeItems);
113 
114  struct QUENTIER_EXPORT IBarcodeItem
115  {
116  virtual ~IBarcodeItem();
117 
118  [[nodiscard]] virtual QString barcode() const = 0;
119  [[nodiscard]] virtual int weight() const = 0;
120  };
121 
122  using IBarcodeItemPtr = std::shared_ptr<IBarcodeItem>;
123 
124  [[nodiscard]] QList<IBarcodeItemPtr> barcodeItems() const;
125  void setBarcodeItems(QList<IBarcodeItemPtr> barcodeItems);
126 
127  // utility::Printable
128  QTextStream & print(QTextStream & strm) const override;
129 
130 private:
131  QSharedDataPointer<ResourceRecognitionIndexItemData> d;
132 };
133 
134 } // namespace quentier
Definition: ResourceRecognitionIndexItem.h:114
Definition: ResourceRecognitionIndexItem.h:101
The Printable class is the interface for Quentier&#39;s internal classes which should be able to write th...
Definition: Printable.h:37
Definition: ResourceRecognitionIndexItem.h:88
Definition: ResourceRecognitionIndexItem.h:75
Definition: ResourceRecognitionIndexItem.h:34