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