|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declaration of CPosLmNameIndexIterator class |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef EPOS_CPOSLMNAMEINDEXITERATOR_H_ |
|
21 #define EPOS_CPOSLMNAMEINDEXITERATOR_H_ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <epos_rposlmlocalnameindex.h> |
|
25 |
|
26 class CPosLmNameIndexIterator : public CBase |
|
27 { |
|
28 public: |
|
29 |
|
30 enum TIndexMode |
|
31 { |
|
32 EModePartial, //< discards already enumerated items on next load |
|
33 EModeFull //< keeps all index items |
|
34 }; |
|
35 |
|
36 public: |
|
37 static CPosLmNameIndexIterator* NewL( |
|
38 RPosLmLocalNameIndex& aIndex, |
|
39 TBool aAscending ); |
|
40 ~CPosLmNameIndexIterator(); |
|
41 |
|
42 TInt Count() const; |
|
43 TInt TotalCount() const; |
|
44 TInt LoadedCount() const; |
|
45 |
|
46 TBool HasMore() const; |
|
47 void LoadMoreL( TInt aCount ); |
|
48 |
|
49 void First(); |
|
50 TBool Next(); |
|
51 TBool AtEnd() const; |
|
52 TInt CurrentPosition() const; |
|
53 |
|
54 const RPosLmLocalNameIndex::CIndexItem& Current() const; |
|
55 |
|
56 void SetMode( TIndexMode aMode ); |
|
57 TIndexMode Mode() const; |
|
58 |
|
59 const RPosLmLocalNameIndex::CIndexItem& Item( TInt aIndex ) const; |
|
60 TInt Find( TPosLmItemId aLmid ) const; |
|
61 |
|
62 protected: |
|
63 CPosLmNameIndexIterator( |
|
64 RPosLmLocalNameIndex& aIndex, |
|
65 TBool aAscending ); |
|
66 |
|
67 void DiscardProcessedItems(); |
|
68 |
|
69 private: |
|
70 RPosLmLocalNameIndex& iIndex; |
|
71 TInt iLeftInIndex; |
|
72 TInt iNextToLoad; |
|
73 |
|
74 RPointerArray<RPosLmLocalNameIndex::CIndexItem> iSortedLandmarks; |
|
75 TInt iCurrent; // index in iSortedLandmarks |
|
76 TIndexMode iMode; |
|
77 |
|
78 TBool iAscending; |
|
79 }; |
|
80 |
|
81 #endif /*EPOS_CPOSLMNAMEINDEXITERATOR_H_*/ |