WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZLogMap.h
Go to the documentation of this file.
1 #ifndef ZLOGMAP_H
2 #define ZLOGMAP_H
3 
4 #include <QObject>
5 #include <QMap>
6 #include <QVariant>
7 #include "zglobal.h"
8 #include "ZTableModel.h"
9 #include "ZblLogMap.h"
10 
11 namespace Zbl
12 {
13 class ZLogReader;
14 
28 class ZLogMap : public QObject
29 {
30  friend class ZLogReclinkModel;
31  Q_OBJECT
32 
33 private:
34  Q_DISABLE_COPY(ZLogMap)
35 
36 public:
37 
42  enum MarkType {
47  };
48  Q_ENUMS(MarkType)
49 
50  //Q_DECLARE_FLAGS(MarkTypes, MarkType)
51 
52 
56  enum MarkRole {
57  FirstID = ZblLogMapData::FirstID, // id of first log record
58  SeekPosition = ZblLogMapData::SeekPosition, // file seek position of first record
59  MessageText = ZblLogMapData::MessageText // message text (optional field)
60  };
61 
62  Q_ENUMS(MarkRole)
63 
64  typedef QList<ZLogMap*> zLogMapList;
65 
71  explicit ZLogMap(ZLogReader* reader);
72 
77  Q_PROPERTY(int mapType READ logMapType)
78 
79 
80 
85  static void registerType();
86 
93 
94 
100  Q_INVOKABLE QObject* getReader() const;
101 
102 
103 
104 signals:
105 
110  void selectionUpdated();
111 
112 public slots:
113 
121  void insertMark(qint64 recordID,
122  qint64 lastRecordID,
123  qint64 seekPosition);
124 
133  bool hasMark(qint64 recordID);
134 
150  qint64 findNextMark(qint64 startID, bool forward = true) const;
151 
160  bool removeMark(qint64 recordID, qint64 lastRecordID);
161 
166  // TBD: change name to clear();
167 
168  void clear();
169 
170 #if 0
171 
176  QObject* getMarkModel();
177 #endif
178 
179 protected:
180 
181 #if 0
182 
188  static bool createMapModel(ZTableModel* model);
189 
201  bool initializeFromModel(QObject* mapModel);
202 #endif
203 
209  ZLogReader* getZReader() const;
210 
211 
212 
218  virtual int logMapType();
219 
220 
221 #if 0
222 
238  virtual void appendModelData(
239  const MarkNode& logMark,
240  ZDataRow data);
241 #endif
242 
243 
248  //void createTags();
249 
250 public:
251 
252  //const QMap<qint64, MarkNode>& getMap() const;
253 
254  //void setMap(const QMap<qint64, MarkNode>& logMap);
255 
256 #if 0
257  qint64 insertModelMark(
258  ZTableModelZLogMap::MarkNode* model,
259  qint64 recordID,
260  qint64 lastRecordID,
261  qint64 seekPosition,
262  QVariant name,
263  QVariant note);
264 
265  void insertRole(ZRoleRow& row, int role, QVariant data);
266 #endif
267 
268 protected:
269 
271 
276 
282 
283 # if 0
284 
289  //static qint64 m_nextMarkID;
290 
297  //bool m_enableLookups;
298 #endif
299 
300 };
301 
302 //Q_DECLARE_OPERATORS_FOR_FLAGS(ZLogMap::MarkTypes)
303 
304 } // Zbl
305 
306 
307 //Q_DECLARE_METATYPE(Zbl::ZLogMap)
308 
309 //Q_DECLARE_METATYPE(Zbl::ZLogMap::MarkType)
310 //Q_DECLARE_METATYPE(Zbl::ZLogMap::MarkRole)
311 
312 
313 #endif // ZLOGMAP_H
A data model containing a list of log record links. This is used for displaying a ZLogMap object...
MarkType getMapType()
returns this log map&#39;s mark type
Definition: ZLogMap.cpp:184
#define ZBL_DECLARE_LOGGED_OBJECT
Definition: zglobal.h:94
QList< ZLogMap * > zLogMapList
Definition: ZLogMap.h:64
A QML type that manages reading JSON formatted Zuble log files. QML programs create using Zbl...
Definition: ZLogReader.h:62
ZLogReader * getZReader() const
Returns the foreground log file reader object for this search.
Definition: ZLogMap.cpp:48
void insertMark(qint64 recordID, qint64 lastRecordID, qint64 seekPosition)
Creates a new log mark in the database.
Definition: ZLogMap.cpp:147
Maintains a list of log record links pertaining to a specific log file.
Definition: ZLogMap.h:28
bool hasMark(qint64 recordID)
Determine if the log map contains a mark for the specified log record.
Definition: ZLogMap.cpp:166
ZLogReader * m_reader
The log file reader that created this search object.
Definition: ZLogMap.h:281
Definition: ZAndGate.cpp:6
static void registerType()
Registers ZLogMap as a QML type.
Definition: ZLogMap.cpp:32
QMap< int, QList< QVariant > > ZRoleRow
Represents a single row (or column for column headers) of data cell values for multiple roles...
Definition: ZTableModel.h:63
void clear()
Removes all marks from the log map.
Definition: ZLogMap.cpp:160
int mapType
Definition: ZLogMap.h:77
This two dimensional table model is used to store and manipulate data.
Definition: ZTableModel.h:96
MarkType
Types of log maps: Invalid, Selection, Search, Bookmark.
Definition: ZLogMap.h:42
bool removeMark(qint64 recordID, qint64 lastRecordID)
Removes the specified mark from the log map.
Definition: ZLogMap.cpp:171
ZBL_DECLARE_LOGGED_OBJECT ZblLogMap m_map
Create the m_tag object that presents a Javascript interface to constant integer values.
Definition: ZLogMap.h:275
virtual int logMapType()
Returns log map type. Subclasses override this to return their map type.
Definition: ZLogMap.cpp:41
void selectionUpdated()
Sent whenever the ZLogMap state has been changed.
Q_INVOKABLE QObject * getReader() const
Returns the foreground log file reader object for this log map.
Definition: ZLogMap.cpp:53
Logmap objects contain a collection of compressed links to log records.
Definition: ZblLogMap.h:19
qint64 findNextMark(qint64 startID, bool forward=true) const
Search forward or backward for the next mark from a specified starting position.
Definition: ZLogMap.cpp:189
QList< QVariant > ZDataRow
Represents a single row (or column for column headers) of data cell values for a single role...
Definition: ZTableModel.h:57
MarkRole
Roles for the log map&#39;s data model.
Definition: ZLogMap.h:56