~ubuntu-branches/ubuntu/karmic/notecase/karmic

« back to all changes in this revision

Viewing changes to src/lib/DocumentIterator.h

  • Committer: Bazaar Package Importer
  • Author(s): Vijay(Vijay)
  • Date: 2007-06-14 00:13:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070614001348-z9e2vbgtenb9nhoo
Tags: 1.5.6-0ubuntu1
* New Upstream release 
*  The libgnomevfs2-dev is also added to Build-Depends 

Show diffs side-by-side

added added

removed removed

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