1 lbsrequestor.h |
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __LBSREQUESTOR_H__ |
|
17 #define __LBSREQUESTOR_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 // Forward declarations |
|
22 class RReadStream; |
|
23 class RWriteStream; |
|
24 |
|
25 |
|
26 class CRequestorBase : public CBase |
|
27 /** |
|
28 Each instance of a CRequestor class is used to hold the identity of one |
|
29 of the parties involved requesting the location. The class contains three |
|
30 data fields that indicate: |
|
31 (1) If the requesting party is a "service" or an actual person ("contact"). |
|
32 (2) A descriptor that identifiers the requestor and |
|
33 (3) a field that indicates which format the information is in |
|
34 - for example, a telephone number, URL or email address. |
|
35 |
|
36 @publishedAll |
|
37 @released |
|
38 */ |
|
39 { |
|
40 public: |
|
41 /** defined type for TRequestorType */ |
|
42 typedef TInt TRequestorType; |
|
43 |
|
44 /** |
|
45 TRequestorType |
|
46 */ |
|
47 enum _TRequestorType |
|
48 { |
|
49 /** Unknown Requestor */ |
|
50 ERequestorUnknown, |
|
51 /** Requestor of type Service */ |
|
52 ERequestorService, |
|
53 /** Requestor of type Contact */ |
|
54 ERequestorContact |
|
55 }; |
|
56 |
|
57 /** defined type for TRequestorFormat */ |
|
58 typedef TInt TRequestorFormat; |
|
59 |
|
60 /** |
|
61 TRequestorFormat |
|
62 */ |
|
63 enum _TRequestorFormat |
|
64 { |
|
65 /** Requestor format unknown */ |
|
66 EFormatUnknown, |
|
67 /** EFormatApplication */ |
|
68 EFormatApplication, |
|
69 /** EFormatTelephone */ |
|
70 EFormatTelephone, |
|
71 /** EFormatUrl */ |
|
72 EFormatUrl, |
|
73 /** EFormatMail */ |
|
74 EFormatMail |
|
75 }; |
|
76 |
|
77 IMPORT_C ~CRequestorBase(); |
|
78 |
|
79 IMPORT_C void SetRequestorL(TRequestorType aType, |
|
80 TRequestorFormat aFormat, |
|
81 const TDesC& aData); |
|
82 IMPORT_C void GetRequestor(TRequestorType& aType, |
|
83 TRequestorFormat& aFormat, |
|
84 TPtrC& aData) const; |
|
85 |
|
86 IMPORT_C TRequestorType RequestorType() const; |
|
87 IMPORT_C TRequestorFormat RequestorFormat() const; |
|
88 IMPORT_C TDesC& RequestorData() const; |
|
89 |
|
90 IMPORT_C virtual void InternalizeL(RReadStream& aStream); |
|
91 IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const; |
|
92 |
|
93 protected: |
|
94 IMPORT_C CRequestorBase(); |
|
95 |
|
96 IMPORT_C void ConstructL(TRequestorType aType, |
|
97 TRequestorFormat aFormat, |
|
98 const TDesC& aData); |
|
99 // Reserved for future expansion - derived classes should see documentation |
|
100 // on how this is to be used. |
|
101 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
|
102 |
|
103 protected: |
|
104 /** Requestor type */ |
|
105 TRequestorType iRequestorType; |
|
106 /** Requestor format */ |
|
107 TRequestorFormat iFormat; |
|
108 private: |
|
109 /** This is owned by the CRequestor */ |
|
110 HBufC* iData; |
|
111 /** Reserved data for future extension */ |
|
112 TAny* iBaseReservedPtr; |
|
113 }; |
|
114 |
|
115 |
|
116 class CRequestor : public CRequestorBase |
|
117 /** |
|
118 CRequestor class for LBS clients |
|
119 @see CRequestorBase |
|
120 @publishedAll |
|
121 @released |
|
122 */ |
|
123 { |
|
124 public: |
|
125 IMPORT_C static CRequestor* New(TRequestorType aType, |
|
126 TRequestorFormat aFormat, |
|
127 const TDesC& aData); |
|
128 IMPORT_C static CRequestor* NewL(TRequestorType aType, |
|
129 TRequestorFormat aFormat, |
|
130 const TDesC& aData); |
|
131 IMPORT_C static CRequestor* NewLC(TRequestorType aType, |
|
132 TRequestorFormat aFormat, |
|
133 const TDesC& aData); |
|
134 IMPORT_C static CRequestor* NewL(RReadStream& aStream); |
|
135 |
|
136 ~CRequestor(); |
|
137 |
|
138 private: |
|
139 CRequestor(); |
|
140 }; |
|
141 |
|
142 class RRequestorStack : public RPointerArray<CRequestor> |
|
143 /** |
|
144 Most standard applications will not use the RRequestorStack. Instead, |
|
145 they will call the simpler RPositioner::SetRequestor() method to |
|
146 identify themselves. |
|
147 |
|
148 RRequestorStack will typically only be used if the application needs to |
|
149 identify a chain of requestors. For example, a remote party is requesting |
|
150 the location and this is routed through a local application. In this |
|
151 situation, the application should identify both itself and the remote party. |
|
152 |
|
153 @see RPointerArray |
|
154 @publishedAll |
|
155 @released |
|
156 */ |
|
157 { |
|
158 public: |
|
159 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
160 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
161 |
|
162 private: |
|
163 static void CleanupResetAndDestroy(TAny* aArray); |
|
164 |
|
165 private: |
|
166 /** Unused variable for future expansion. */ |
|
167 TUint8 iReserved[8]; |
|
168 }; |
|
169 |
|
170 #endif //__LBSREQUESTOR_H__ |