|
1 /* |
|
2 * Copyright (c) 2007-2008 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 class for going through remote party info |
|
15 * of ongoing calls. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CCALLREMOTEPARTYINFOITER_H_ |
|
20 #define CCALLREMOTEPARTYINFOITER_H_ |
|
21 |
|
22 // forward declarations |
|
23 class CCallRemotePartyInfos; |
|
24 |
|
25 // CLASS DECLARATION |
|
26 |
|
27 /** |
|
28 * Class to be used for going through ongoing calls. |
|
29 * |
|
30 * @code |
|
31 * 1) Go trough all items, no need to call Count() first. |
|
32 * CCallRemotePartyInfoIter& iter = iRemoteInfos->GetRemotePartyInformationL(); |
|
33 * |
|
34 * for( iter.First(); !iter.IsDone(); iter.Next() ) |
|
35 * { |
|
36 * const MCallRemotePartyInfo& remoteInfo( iter.Current() ); |
|
37 * DoSomethingWhenCallDetected( remoteInfo ); |
|
38 * } |
|
39 * |
|
40 * 2) Check if there are any calls |
|
41 * CCallRemotePartyInfoIter& iter = iRemoteInfos->GetRemotePartyInformationL(); |
|
42 * TInt amountOfCalls = iter.Count(); |
|
43 * |
|
44 * if ( amountOfCalls == 0) |
|
45 * { |
|
46 * DoSomething(); |
|
47 * } |
|
48 * |
|
49 * @endcode |
|
50 * |
|
51 * @lib telephonyservice.lib |
|
52 * @since S60 v5.2 |
|
53 */ |
|
54 NONSHARABLE_CLASS( CCallRemotePartyInfoIter ) : public CBase |
|
55 { |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * @param aRemotePartyInfos Container for remote party information. |
|
61 */ |
|
62 static CCallRemotePartyInfoIter* |
|
63 NewL( CCallRemotePartyInfos& aRemotePartyInfos ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 * @param aRemotePartyInfos Container for remote party information. |
|
68 */ |
|
69 static CCallRemotePartyInfoIter* |
|
70 NewLC( CCallRemotePartyInfos& aRemotePartyInfos ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 ~CCallRemotePartyInfoIter(); |
|
76 |
|
77 /** |
|
78 * Intializes the current item to the first remote party information. |
|
79 * |
|
80 * @since S60 v5.1 |
|
81 */ |
|
82 IMPORT_C void First(); |
|
83 |
|
84 /** |
|
85 * Tests whether the last item has been reached. |
|
86 * |
|
87 * @since S60 v5.1 |
|
88 */ |
|
89 IMPORT_C TBool IsDone() const; |
|
90 |
|
91 /** |
|
92 * Advances the current item to the next remote party information. |
|
93 * |
|
94 * @since S60 v5.1 |
|
95 */ |
|
96 IMPORT_C void Next(); |
|
97 |
|
98 /** |
|
99 * Returns the count of items. |
|
100 * |
|
101 * @since S60 v5.1 |
|
102 * @return Amount of calls |
|
103 */ |
|
104 IMPORT_C TInt Count() const; |
|
105 |
|
106 /** |
|
107 * Returns the current remote party information. |
|
108 * Panic happens if there are no items. |
|
109 * |
|
110 * @since S60 v5.1 |
|
111 * @return Reference to the call. |
|
112 */ |
|
113 IMPORT_C const MCallRemotePartyInfo& Current() const; |
|
114 |
|
115 private: |
|
116 |
|
117 /** |
|
118 * Constructor for performing 1st stage construction |
|
119 */ |
|
120 CCallRemotePartyInfoIter( CCallRemotePartyInfos& aRemotePartyInfos ); |
|
121 |
|
122 /** |
|
123 * EPOC default constructor for performing 2nd stage construction |
|
124 */ |
|
125 void ConstructL(); |
|
126 |
|
127 private: // data |
|
128 |
|
129 CCallRemotePartyInfos& iRemotePartyInfos; |
|
130 TInt iCurrentIndex; |
|
131 |
|
132 }; |
|
133 |
|
134 #endif /* CCALLREMOTEPARTYINFOITER_H_ */ |