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