williamr@2: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __LBSREQUESTOR_H__ williamr@2: #define __LBSREQUESTOR_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: // Forward declarations williamr@2: class RReadStream; williamr@2: class RWriteStream; williamr@2: williamr@2: williamr@2: class CRequestorBase : public CBase williamr@2: /** williamr@2: Each instance of a CRequestor class is used to hold the identity of one williamr@2: of the parties involved requesting the location. The class contains three williamr@2: data fields that indicate: williamr@2: (1) If the requesting party is a "service" or an actual person ("contact"). williamr@2: (2) A descriptor that identifiers the requestor and williamr@2: (3) a field that indicates which format the information is in williamr@2: - for example, a telephone number, URL or email address. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** defined type for TRequestorType */ williamr@2: typedef TInt TRequestorType; williamr@2: williamr@2: /** williamr@2: TRequestorType williamr@2: */ williamr@2: enum _TRequestorType williamr@2: { williamr@2: /** Unknown Requestor */ williamr@2: ERequestorUnknown, williamr@2: /** Requestor of type Service */ williamr@2: ERequestorService, williamr@2: /** Requestor of type Contact */ williamr@2: ERequestorContact williamr@2: }; williamr@2: williamr@2: /** defined type for TRequestorFormat */ williamr@2: typedef TInt TRequestorFormat; williamr@2: williamr@2: /** williamr@2: TRequestorFormat williamr@2: */ williamr@2: enum _TRequestorFormat williamr@2: { williamr@2: /** Requestor format unknown */ williamr@2: EFormatUnknown, williamr@2: /** EFormatApplication */ williamr@2: EFormatApplication, williamr@2: /** EFormatTelephone */ williamr@2: EFormatTelephone, williamr@2: /** EFormatUrl */ williamr@2: EFormatUrl, williamr@2: /** EFormatMail */ williamr@2: EFormatMail williamr@2: }; williamr@2: williamr@2: IMPORT_C ~CRequestorBase(); williamr@2: williamr@2: IMPORT_C void SetRequestorL(TRequestorType aType, williamr@2: TRequestorFormat aFormat, williamr@2: const TDesC& aData); williamr@2: IMPORT_C void GetRequestor(TRequestorType& aType, williamr@2: TRequestorFormat& aFormat, williamr@2: TPtrC& aData) const; williamr@2: williamr@2: IMPORT_C TRequestorType RequestorType() const; williamr@2: IMPORT_C TRequestorFormat RequestorFormat() const; williamr@2: IMPORT_C TDesC& RequestorData() const; williamr@2: williamr@2: IMPORT_C virtual void InternalizeL(RReadStream& aStream); williamr@2: IMPORT_C virtual void ExternalizeL(RWriteStream& aStream) const; williamr@2: williamr@2: protected: williamr@2: IMPORT_C CRequestorBase(); williamr@2: williamr@2: IMPORT_C void ConstructL(TRequestorType aType, williamr@2: TRequestorFormat aFormat, williamr@2: const TDesC& aData); williamr@2: // Reserved for future expansion - derived classes should see documentation williamr@2: // on how this is to be used. williamr@2: IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); williamr@2: williamr@2: protected: williamr@2: /** Requestor type */ williamr@2: TRequestorType iRequestorType; williamr@2: /** Requestor format */ williamr@2: TRequestorFormat iFormat; williamr@2: private: williamr@2: /** This is owned by the CRequestor */ williamr@2: HBufC* iData; williamr@2: /** Reserved data for future extension */ williamr@2: TAny* iBaseReservedPtr; williamr@2: }; williamr@2: williamr@2: williamr@2: class CRequestor : public CRequestorBase williamr@2: /** williamr@2: CRequestor class for LBS clients williamr@2: @see CRequestorBase williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CRequestor* New(TRequestorType aType, williamr@2: TRequestorFormat aFormat, williamr@2: const TDesC& aData); williamr@2: IMPORT_C static CRequestor* NewL(TRequestorType aType, williamr@2: TRequestorFormat aFormat, williamr@2: const TDesC& aData); williamr@2: IMPORT_C static CRequestor* NewLC(TRequestorType aType, williamr@2: TRequestorFormat aFormat, williamr@2: const TDesC& aData); williamr@2: IMPORT_C static CRequestor* NewL(RReadStream& aStream); williamr@2: williamr@2: ~CRequestor(); williamr@2: williamr@2: private: williamr@2: CRequestor(); williamr@2: }; williamr@2: williamr@2: class RRequestorStack : public RPointerArray williamr@2: /** williamr@2: Most standard applications will not use the RRequestorStack. Instead, williamr@2: they will call the simpler RPositioner::SetRequestor() method to williamr@2: identify themselves. williamr@2: williamr@2: RRequestorStack will typically only be used if the application needs to williamr@2: identify a chain of requestors. For example, a remote party is requesting williamr@2: the location and this is routed through a local application. In this williamr@2: situation, the application should identify both itself and the remote party. williamr@2: williamr@2: @see RPointerArray williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C void InternalizeL(RReadStream& aStream); williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; williamr@2: williamr@2: private: williamr@2: static void CleanupResetAndDestroy(TAny* aArray); williamr@2: williamr@2: private: williamr@2: /** Unused variable for future expansion. */ williamr@2: TUint8 iReserved[8]; williamr@2: }; williamr@2: williamr@2: #endif //__LBSREQUESTOR_H__