|
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: Iterator for traversing NAT-plugin container elements. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef T_TICENATPLUGINCONTAINERITER_H |
|
23 #define T_TICENATPLUGINCONTAINERITER_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include "cicenatplugincontainer.h" |
|
27 |
|
28 /** |
|
29 * Iterator for traversing plugins contained by NAT-plugin container. |
|
30 * |
|
31 * @lib icecandidatehandler.dll |
|
32 * @since S60 v3.2 |
|
33 */ |
|
34 class TIceNatPluginContainerIter |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Constructor. |
|
41 * |
|
42 * @since S60 3.2 |
|
43 * @param aContainer The container to traverse |
|
44 */ |
|
45 inline TIceNatPluginContainerIter( CIceNatPluginContainer& aContainer ) |
|
46 : iIndex( 0 ), iContainer( aContainer ) { } |
|
47 |
|
48 /** |
|
49 * Set iterator position to the first item. |
|
50 * |
|
51 * @since S60 3.2 |
|
52 */ |
|
53 inline void SetToFirst() |
|
54 { iIndex = 0; }; |
|
55 |
|
56 /** |
|
57 * Set iterator position to the last item. |
|
58 * |
|
59 * @since S60 3.2 |
|
60 */ |
|
61 inline void SetToLast() |
|
62 { iIndex = iContainer.iPlugins.Count() - 1; }; |
|
63 |
|
64 /** |
|
65 * Return ETrue if all items are traversed. |
|
66 * |
|
67 * @since S60 3.2 |
|
68 */ |
|
69 inline TBool IsDone() const |
|
70 { return iContainer.iPlugins.Count() |
|
71 ? ( iIndex >= iContainer.iPlugins.Count() ) : ETrue; }; |
|
72 |
|
73 /** |
|
74 * Return item from current position. |
|
75 * |
|
76 * @since S60 3.2 |
|
77 */ |
|
78 inline CNATFWPluginApi* CurrentItem() |
|
79 { |
|
80 if ( IsDone() ) |
|
81 { |
|
82 return NULL; |
|
83 } |
|
84 else |
|
85 { |
|
86 return iContainer.iPlugins[iIndex]; |
|
87 } |
|
88 }; |
|
89 |
|
90 inline CNATFWPluginApi* operator++( TInt ) |
|
91 { return iIndex < iContainer.iPlugins.Count() |
|
92 ? iContainer.iPlugins[iIndex++] : NULL; }; |
|
93 |
|
94 private: |
|
95 |
|
96 TIceNatPluginContainerIter(); |
|
97 |
|
98 private: // data |
|
99 |
|
100 /** |
|
101 * The position in the container. |
|
102 */ |
|
103 TInt iIndex; |
|
104 |
|
105 /** |
|
106 * Container for which iterator is created. |
|
107 * Not own. |
|
108 */ |
|
109 CIceNatPluginContainer& iContainer; |
|
110 }; |
|
111 |
|
112 #endif // T_TICENATPLUGINCONTAINERITER_H |