libquentier  0.4.0
The library for rich desktop clients of Evernote service
ResourceRecognitionIndexItem.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_RECOGNITION_INDEX_ITEM_H
20 #define LIB_QUENTIER_TYPES_RESOURCE_RECOGNITION_INDEX_ITEM_H
21 
22 #include <quentier/utility/Linkage.h>
23 #include <quentier/utility/Printable.h>
24 #include <QByteArray>
25 #include <QSharedDataPointer>
26 
27 namespace quentier {
28 
29 QT_FORWARD_DECLARE_CLASS(ResourceRecognitionIndexItemData)
30 
31 class QUENTIER_EXPORT ResourceRecognitionIndexItem: public Printable
32 {
33 public:
38 
39  bool isValid() const;
40 
41  int x() const;
42  void setX(const int x);
43 
44  int y() const;
45  void setY(const int y);
46 
47  int h() const;
48  void setH(const int h);
49 
50  int w() const;
51  void setW(const int w);
52 
53  int offset() const;
54  void setOffset(const int offset);
55 
56  int duration() const;
57  void setDuration(const int duration);
58 
59  QVector<int> strokeList() const;
60  int numStrokes() const;
61  bool strokeAt(const int strokeIndex, int & stroke) const;
62  bool setStrokeAt(const int strokeIndex, const int stroke);
63  void setStrokeList(const QVector<int> & strokeList);
64  void reserveStrokeListSpace(const int numItems);
65  void addStroke(const int stroke);
66  bool removeStroke(const int stroke);
67  bool removeStrokeAt(const int strokeIndex);
68 
69  struct TextItem
70  {
71  TextItem() : m_text(), m_weight(-1) {}
72 
73  bool operator==(const TextItem & other) const { return (m_text == other.m_text) && (m_weight == other.m_weight); }
74 
75  QString m_text;
76  int m_weight;
77  };
78 
79  QVector<TextItem> textItems() const;
80  int numTextItems() const;
81  bool textItemAt(const int textItemIndex, TextItem & textItem) const;
82  bool setTextItemAt(const int textItemIndex, const TextItem & textItem);
83  void setTextItems(const QVector<TextItem> & textItems);
84  void reserveTextItemsSpace(const int numItems);
85  void addTextItem(const TextItem & item);
86  bool removeTextItem(const TextItem & item);
87  bool removeTextItemAt(const int textItemIndex);
88 
89  struct ObjectItem
90  {
91  ObjectItem() : m_objectType(), m_weight(-1) {}
92 
93  bool operator==(const ObjectItem & other) const { return (m_objectType == other.m_objectType) && (m_weight == other.m_weight); }
94 
95  QString m_objectType;
96  int m_weight;
97  };
98 
99  QVector<ObjectItem> objectItems() const;
100  int numObjectItems() const;
101  bool objectItemAt(const int objectItemIndex, ObjectItem & objectItem) const;
102  bool setObjectItemAt(const int objectItemIndex, const ObjectItem & objectItem);
103  void setObjectItems(const QVector<ObjectItem> & objectItems);
104  void reserveObjectItemsSpace(const int numItems);
105  void addObjectItem(const ObjectItem & item);
106  bool removeObjectItem(const ObjectItem & item);
107  bool removeObjectItemAt(const int objectItemIndex);
108 
109  struct ShapeItem
110  {
111  ShapeItem() : m_shapeType(), m_weight(-1) {}
112 
113  bool operator==(const ShapeItem & other) const { return (m_shapeType == other.m_shapeType) && (m_weight == other.m_weight); }
114 
115  QString m_shapeType;
116  int m_weight;
117  };
118 
119  QVector<ShapeItem> shapeItems() const;
120  int numShapeItems() const;
121  bool shapeItemAt(const int shapeItemIndex, ShapeItem & shapeItem) const;
122  bool setShapeItemAt(const int shapeItemIndex, const ShapeItem & shapeItem);
123  void setShapeItems(const QVector<ShapeItem> & shapeItems);
124  void reserveShapeItemsSpace(const int numItems);
125  void addShapeItem(const ShapeItem & item);
126  bool removeShapeItem(const ShapeItem & item);
127  bool removeShapeItemAt(const int shapeItemIndex);
128 
129  struct BarcodeItem
130  {
131  BarcodeItem() : m_barcode(), m_weight(-1) {}
132 
133  bool operator==(const BarcodeItem & other) const { return (m_barcode == other.m_barcode) && (m_weight == other.m_weight); }
134 
135  QString m_barcode;
136  int m_weight;
137  };
138 
139  QVector<BarcodeItem> barcodeItems() const;
140  int numBarcodeItems() const;
141  bool barcodeItemAt(const int barcodeItemIndex, BarcodeItem & barcodeItem) const;
142  bool setBarcodeItemAt(const int barcodeItemIndex, const BarcodeItem & barcodeItem);
143  void setBarcodeItems(const QVector<BarcodeItem> & barcodeItems);
144  void reserveBarcodeItemsSpace(const int numItems);
145  void addBarcodeItem(const BarcodeItem & item);
146  bool removeBarcodeItem(const BarcodeItem & item);
147  bool removeBarcodeItemAt(const int barcodeItemIndex);
148 
149  virtual QTextStream & print(QTextStream & strm) const Q_DECL_OVERRIDE;
150 
151 private:
152  QSharedDataPointer<ResourceRecognitionIndexItemData> d;
153 };
154 
155 } // namespace quentier
156 
157 #endif // LIB_QUENTIER_TYPES_RESOURCE_RECOGNITION_INDEX_ITEM_H
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:54
Definition: ResourceRecognitionIndexItem.h:109
Definition: ResourceRecognitionIndexItem.h:89
Definition: ResourceRecognitionIndexItem.h:129
Definition: ResourceRecognitionIndexItem.h:69
Definition: ResourceRecognitionIndexItem.h:31