1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_
25 #define _CONNECTIVITY_DBASE_INDEXITER_HXX_
26 
27 #include "file/fcode.hxx"
28 #include "dbase/DIndex.hxx"
29 #include "dbase/dindexnode.hxx"
30 
31 namespace connectivity
32 {
33 	namespace dbase
34 	{
35 		//==================================================================
36 		// IndexIterator
37 		//==================================================================
38 		class OIndexIterator
39 		{
40 		protected:
41 			file::OBoolOperator*	m_pOperator;
42 			const file::OOperand* 	m_pOperand;
43 			ODbaseIndex*			m_pIndex;
44 			ONDXPagePtr				m_aRoot,
45 									m_aCurLeaf;
46 			sal_uInt16					m_nCurNode;
47 
48 		protected:
49 			sal_uIntPtr Find(sal_Bool bFirst);
50 			sal_uIntPtr GetCompare(sal_Bool bFirst);
51 			sal_uIntPtr GetLike(sal_Bool bFirst);
52 			sal_uIntPtr GetNull(sal_Bool bFirst);
53 			sal_uIntPtr GetNotNull(sal_Bool bFirst);
54 
55 			ONDXKey* GetFirstKey(ONDXPage* pPage,
56 								const file::OOperand& rKey);
57 			ONDXKey* GetNextKey();
GetIndex() const58 			ODbaseIndex* GetIndex() const {return m_pIndex;}
59 
60 
61 		public:
OIndexIterator(ODbaseIndex * pInd,file::OBoolOperator * pOp,const file::OOperand * pOper)62 			OIndexIterator(ODbaseIndex* pInd,
63 							file::OBoolOperator* pOp,
64 							const file::OOperand* pOper)
65 				:m_pOperator(pOp)
66 				,m_pOperand(pOper)
67 				,m_pIndex(pInd)
68 				,m_nCurNode(NODE_NOTFOUND)
69 			{
70 				pInd->acquire();
71 			}
72 
73 			virtual ~OIndexIterator();
74 			sal_uIntPtr First();
75 			sal_uIntPtr Next();
76 
77 		};
78 	}
79 }
80 #endif // _CONNECTIVITY_DBASE_INDEXITER_HXX_
81 
82