v2.0.0
Loading...
Searching...
No Matches
fiff_dir_node.h
Go to the documentation of this file.
1//=============================================================================================================
31
32#ifndef FIFF_DIR_NODE_H
33#define FIFF_DIR_NODE_H
34
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
39#include "fiff_global.h"
40#include "fiff_constants.h"
41#include "fiff_types.h"
42#include "fiff_dir_entry.h"
43#include "fiff_id.h"
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QList>
50#include <QSharedPointer>
51#include <QStringList>
52#include <QTextStream>
53#include <memory>
54
55//=============================================================================================================
56// DEFINE NAMESPACE FIFFLIB
57//=============================================================================================================
58
59namespace FIFFLIB
60{
61
62class FiffStream;
63class FiffTag;
64
65//=============================================================================================================
84{
85public:
86 using SPtr = QSharedPointer<FiffDirNode>;
87 using ConstSPtr = QSharedPointer<const FiffDirNode>;
88 using UPtr = std::unique_ptr<FiffDirNode>;
89 using ConstUPtr = std::unique_ptr<const FiffDirNode>;
90
91 //=========================================================================================================
96
97 //=========================================================================================================
103 FiffDirNode(const FiffDirNode* p_FiffDirTree);
104
105 //=========================================================================================================
109 ~FiffDirNode();
110
111 //=========================================================================================================
122 static bool copy_tree(QSharedPointer<FiffStream>& p_pStreamIn, const FiffId& in_id, const QList<QSharedPointer<FiffDirNode>>& p_Nodes, QSharedPointer<FiffStream>& p_pStreamOut);
123
124 //=========================================================================================================
130 inline bool isEmpty() const
131 {
132 return this->type < 0;
133 }
134
135 //=========================================================================================================
143 QList<FiffDirNode::SPtr> dir_tree_find(fiff_int_t p_kind) const;
144
145 //=========================================================================================================
159 inline bool find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
160
161 //=========================================================================================================
175 bool find_tag(FiffStream* p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const;
176
177 //=========================================================================================================
185 bool has_tag(fiff_int_t findkind);
186
187 //=========================================================================================================
195 bool has_kind(fiff_int_t p_kind) const;
196
197 //=========================================================================================================
205 void print(QTextStream& out, int indent = 0) const;
206
207 //=========================================================================================================
213 fiff_int_t nent() const;
214
215 //=========================================================================================================
221 fiff_int_t nchild() const;
222
223public:
226 QList<FiffDirEntry::SPtr> dir;
227 // fiff_int_t nent; /**< Number of entries in this node. */
228 QList<FiffDirEntry::SPtr> dir_tree;
233 QList<FiffDirNode::SPtr> children;
234 // fiff_int_t nchild; /**< Number of child nodes. */ -> use nchild() instead
235};
236
237//=============================================================================================================
238// INLINE DEFINITIONS
239//=============================================================================================================
240
241inline bool FiffDirNode::find_tag(QSharedPointer<FiffStream>& p_pStream, fiff_int_t findkind, std::unique_ptr<FiffTag>& p_pTag) const
242{
243 return find_tag(p_pStream.data(), findkind, p_pTag);
244}
245} // NAMESPACE
246
247#endif // FIFF_DIR_NODE_H
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
Single entry of the FIFF tag directory: kind, type, byte size and absolute file position.
128-bit FIFF identifier record (machine ID + creation time) used to stamp files, blocks and parent re...
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
FIFF file I/O, in-memory data structures and high-level readers/writers.
qint32 fiff_int_t
Definition fiff_types.h:86
fiff_int_t nchild() const
QList< FiffDirNode::SPtr > children
bool find_tag(FiffStream *p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
std::unique_ptr< const FiffDirNode > ConstUPtr
FiffDirNode::SPtr parent
QSharedPointer< FiffDirNode > SPtr
fiff_int_t nent() const
void print(QTextStream &out, int indent=0) const
bool has_kind(fiff_int_t p_kind) const
bool has_tag(fiff_int_t findkind)
QList< FiffDirEntry::SPtr > dir
QList< FiffDirEntry::SPtr > dir_tree
std::unique_ptr< FiffDirNode > UPtr
bool find_tag(QSharedPointer< FiffStream > &p_pStream, fiff_int_t findkind, std::unique_ptr< FiffTag > &p_pTag) const
static bool copy_tree(QSharedPointer< FiffStream > &p_pStreamIn, const FiffId &in_id, const QList< QSharedPointer< FiffDirNode > > &p_Nodes, QSharedPointer< FiffStream > &p_pStreamOut)
QSharedPointer< const FiffDirNode > ConstSPtr
128-bit FIFF identifier: hardware machine ID plus creation time, stamped on every file and block.
Definition fiff_id.h:69
FIFF tag-stream reader/writer: wraps a QIODevice and exposes typed read_* / write_* methods for every...
FIFF tag: 16-byte header (kind, type, size, next) plus payload, with typed decoders for every FIFFT_*...
Definition fiff_tag.h:161