1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Imlpements iterator/helper methods for traversing NoteDocument object
7
////////////////////////////////////////////////////////////////////////////
9
#ifndef DOCUMENTITERATOR_H__
10
#define DOCUMENTITERATOR_H__
14
#endif // _MSC_VER > 1000
16
#include "NoteDocument.h"
18
#define ROOT_PARENT_ID -1
20
class DocumentIterator
23
DocumentIterator(NoteDocument &doc);
24
virtual ~DocumentIterator();
27
int GetChildCount(int nParentID, bool bRecursive = false);
28
int GetChildIdx(int nParentID, int nSiblingIdx);
30
bool IsSiblingByIdx(int nIdx1, int nIdx2);
31
bool IsAncestorByIdx(int nAncestorIdx, int nIdx);
33
//TOFIX move some methods from NoteDocument
34
NoteNode &GetNodeByIdx(int nIdx);
35
NoteNode &GetNodeByID(int nID);
37
//recursive index is when we count tree items in depth-first mode
38
int RecursiveIdx2NodeIdx(int nIdx);
39
int NodeIdx2RecursiveIdx(int nIdx);
42
int RecursiveGetIdx(int nIdx, int nParentID, int &nCounter);
47
#endif // DOCUMENTITERATOR_H__
1
////////////////////////////////////////////////////////////////////////////
2
// NoteCase notes manager project <http://notecase.sf.net>
4
// This code is licensed under BSD license.See "license.txt" for more details.
6
// File: Imlpements iterator/helper methods for traversing NoteDocument object
7
////////////////////////////////////////////////////////////////////////////
9
#ifndef DOCUMENTITERATOR_H__
10
#define DOCUMENTITERATOR_H__
14
#endif // _MSC_VER > 1000
16
#include "NoteDocument.h"
18
#define ROOT_PARENT_ID -1
20
class DocumentIterator
23
DocumentIterator(NoteDocument &doc);
24
virtual ~DocumentIterator();
26
inline NoteDocument &GetDocument(){ return m_doc; }
28
int GetChildCount(int nParentID, bool bRecursive = false);
29
int GetChildIdx(int nParentID, int nSiblingIdx);
31
bool IsSiblingByIdx(int nIdx1, int nIdx2);
32
bool IsAncestorByIdx(int nAncestorIdx, int nIdx);
33
int CalcNodeLevel(int nIdx);
35
//TOFIX move some methods from NoteDocument
36
NoteNode &GetNodeByID(int nID);
38
//recursive index is when we count tree items in depth-first mode
39
int RecursiveIdx2NodeIdx(int nIdx);
40
int NodeIdx2RecursiveIdx(int nIdx);
43
int RecursiveGetIdx(int nIdx, int nParentID, int &nCounter);
48
#endif // DOCUMENTITERATOR_H__