xref: /trunk/main/connectivity/source/inc/dbase/DIndexIter.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_
29 #define _CONNECTIVITY_DBASE_INDEXITER_HXX_
30 
31 #include "file/fcode.hxx"
32 #include "dbase/DIndex.hxx"
33 #include "dbase/dindexnode.hxx"
34 
35 namespace connectivity
36 {
37     namespace dbase
38     {
39         //==================================================================
40         // IndexIterator
41         //==================================================================
42         class OIndexIterator
43         {
44         protected:
45             file::OBoolOperator*    m_pOperator;
46             const file::OOperand*   m_pOperand;
47             ODbaseIndex*            m_pIndex;
48             ONDXPagePtr             m_aRoot,
49                                     m_aCurLeaf;
50             sal_uInt16                  m_nCurNode;
51 
52         protected:
53             sal_uIntPtr Find(sal_Bool bFirst);
54             sal_uIntPtr GetCompare(sal_Bool bFirst);
55             sal_uIntPtr GetLike(sal_Bool bFirst);
56             sal_uIntPtr GetNull(sal_Bool bFirst);
57             sal_uIntPtr GetNotNull(sal_Bool bFirst);
58 
59             ONDXKey* GetFirstKey(ONDXPage* pPage,
60                                 const file::OOperand& rKey);
61             ONDXKey* GetNextKey();
62             ODbaseIndex* GetIndex() const {return m_pIndex;}
63 
64 
65         public:
66             OIndexIterator(ODbaseIndex* pInd,
67                             file::OBoolOperator* pOp,
68                             const file::OOperand* pOper)
69                 :m_pOperator(pOp)
70                 ,m_pOperand(pOper)
71                 ,m_pIndex(pInd)
72                 ,m_nCurNode(NODE_NOTFOUND)
73             {
74                 pInd->acquire();
75             }
76 
77             virtual ~OIndexIterator();
78             sal_uIntPtr First();
79             sal_uIntPtr Next();
80 
81         };
82     }
83 }
84 #endif // _CONNECTIVITY_DBASE_INDEXITER_HXX_
85 
86