|
1 /* |
|
2 * Copyright (c) 2005 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: Class to handle registration and unregistration of subsessions. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPOSLMSUBSESSIONREGISTRY_H |
|
21 #define CPOSLMSUBSESSIONREGISTRY_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32base.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CPosLmSubsessionBase; |
|
28 |
|
29 /** |
|
30 * Class to handle registration and unregistration of subsessions. |
|
31 */ |
|
32 class CPosLmSubsessionRegistry : public CBase |
|
33 { |
|
34 |
|
35 public: // Constructors and destructor |
|
36 |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 * |
|
40 * @return A new instance of this class. |
|
41 */ |
|
42 static CPosLmSubsessionRegistry* NewL(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 ~CPosLmSubsessionRegistry(); |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 /** |
|
52 * Returns a subsession corresponding to a handle. |
|
53 * |
|
54 * @param aHandle The subsession handle. |
|
55 * @return A subsession. |
|
56 */ |
|
57 CPosLmSubsessionBase* SubsessionFromHandleL( |
|
58 /* IN */ TUint aHandle |
|
59 ); |
|
60 |
|
61 /** |
|
62 * Returns a subsession corresponding to an index. |
|
63 * |
|
64 * Range: [0, Count()[ |
|
65 * |
|
66 * Note: this function returns NULL if a subsession has been |
|
67 * removed at the position of the supplied index. |
|
68 * |
|
69 * To iterate all available subsessions, use: |
|
70 * for (TInt i = 0; i < registry->Count(); i++) |
|
71 * { |
|
72 * CPosLmSubsessionBase* subs = registry->SubsessionFromIndex(i); |
|
73 * if (subs) |
|
74 * { |
|
75 * // Do something with the subsession |
|
76 * } |
|
77 * } |
|
78 * |
|
79 * @param aIndex An index within the registry. |
|
80 * @return A subsession or NULL. |
|
81 */ |
|
82 CPosLmSubsessionBase* SubsessionFromIndex( |
|
83 /* IN */ TInt aIndex |
|
84 ); |
|
85 |
|
86 /** |
|
87 * Returns the number of allocated spots in the memory for subsessions. |
|
88 * |
|
89 * Note: this is not the same as the total number of subsessions! Please |
|
90 * refer to @ref SubsessionFromIndex. |
|
91 * |
|
92 * @return The number of subsessions in the registry. |
|
93 */ |
|
94 TInt Count(); |
|
95 |
|
96 /** |
|
97 * Closes the subsession with the specified handle. |
|
98 * |
|
99 * @param aHandle A subsession handle. |
|
100 * @return KErrNone on success. KErrNotFound otherwise. |
|
101 */ |
|
102 TInt CloseSubsession( |
|
103 /* IN */ TUint aHandle |
|
104 ); |
|
105 |
|
106 /** |
|
107 * Adds a subsession to the instance. The subsession ownership is |
|
108 * transferred to the registry. |
|
109 * |
|
110 * @param aSubsession A subsession. |
|
111 * @return A registry handle to the subsession. |
|
112 */ |
|
113 TInt AddInstanceL( |
|
114 /* IN */ CPosLmSubsessionBase* aSubsession |
|
115 ); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * C++ default constructor. |
|
121 */ |
|
122 CPosLmSubsessionRegistry(); |
|
123 |
|
124 /** |
|
125 * By default Symbian 2nd phase constructor is private. |
|
126 */ |
|
127 void ConstructL(); |
|
128 |
|
129 private: // Data |
|
130 |
|
131 CObjectIx* iRegistryIndex; |
|
132 CObjectCon* iRegistryContainer; |
|
133 CObjectConIx* iRegistryContainerIndex; |
|
134 }; |
|
135 |
|
136 |
|
137 #endif //CPOSLMSUBSESSIONREGISTRY_H |
|
138 |
|
139 // End of File |