libraries/clogger/inc/SensibleClient_internals.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // SensibleClient_internals.h
       
     2 // 
       
     3 // Copyright (c) 2006 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef SENSIBLECLIENT_INTERNALS_H
       
    14 #define SENSIBLECLIENT_INTERNALS_H
       
    15 
       
    16 #include <e32base.h>
       
    17 #include "cliserv.h"
       
    18 #include "sensibleclient.h"
       
    19 #include <gdi.h>
       
    20 
       
    21 NONSHARABLE_CLASS(CServerCallbackDispatcher) : public CActive
       
    22 	{
       
    23 public:
       
    24 	CServerCallbackDispatcher(RSensibleSessionBody& aSession);
       
    25 	~CServerCallbackDispatcher();
       
    26 	void Register();
       
    27 
       
    28 private:
       
    29 	void RunL();
       
    30 	void DoCancel();
       
    31 	
       
    32 private:
       
    33 	RSensibleSessionBody& iSession;
       
    34 	TPckgBuf<TServerCallback> iNextCallback;
       
    35 	HBufC8* iCachedCallbackResult8;
       
    36 	HBufC16* iCachedCallbackResult16;
       
    37 	HBufC8* iContext;
       
    38 	TPtr8 iContextPtr; // Stupid client-server...
       
    39 
       
    40 	enum TState { EWaitingForCallback, EWaitingForContext };
       
    41 	TState iState;
       
    42 	};
       
    43 
       
    44 /*
       
    45 // An active object that holds on to a bunch of pointers, and frees them when its
       
    46 // iStatus is completed. Useful for passing temporary descriptors via asyncronous client-
       
    47 // -server (Otherwise you'd have to ensure yourself that they didn't go out of scope before
       
    48 // the server had read from them).
       
    49 // It can optionally pass on the completion message to another TRequestStatus
       
    50 class CCleanupAndComplete : public CActive
       
    51 	{
       
    52 public:
       
    53 	static CCleanupAndComplete* NewLC(TRequestStatus* aClientStatus);
       
    54 	static TInt Create(TRequestStatus*& aStatus, const TDesC16& aDes, TInt& aIpcArg); // Non-leaving convenience functions
       
    55 	static TInt Create(TRequestStatus*& aStatus, const TDesC8& aDes, TInt& aIpcArg); // Non-leaving convenience functions
       
    56 	void SetActive(); // Declare this so RDasherSession etc can activate us
       
    57 	void RunL();
       
    58 	void DoCancel();
       
    59 	CCleanupAndComplete(TRequestStatus* aClientStatus);
       
    60 	void AddL(CBase* aWithDestructor);
       
    61 	void AddL(TAny* aWithoutDestructor);
       
    62 	~CCleanupAndComplete();
       
    63 	
       
    64 public:
       
    65 	RPointerArray<CBase> iWithDestructor;
       
    66 	RArray<TAny*> iWithoutDestructor;
       
    67 
       
    68 private:
       
    69 	TRequestStatus* iClientStatus;
       
    70 	};
       
    71 */
       
    72 
       
    73 // A helper class to parse arguments out of a callback from the server
       
    74 class TCallbackParser
       
    75 	{
       
    76 public:
       
    77 	TCallbackParser(const TServerCallback& aCallback);
       
    78 	void SetContext(TDesC8& aContext);
       
    79 
       
    80 	TInt NextInt();
       
    81 	TUint NextUint();
       
    82 	TPoint NextPoint();
       
    83 	TSize NextSize();
       
    84 	TRgb NextRgb();
       
    85 	TRect NextRect();
       
    86 	TPtrC NextDesC();
       
    87 	TPtrC8 NextDesC8();
       
    88 
       
    89 private:
       
    90 	TAny* Next(TInt aSize, char* aType);
       
    91 
       
    92 private:
       
    93 	const TServerCallback& iCallback;
       
    94 	TDesC8* iContext;
       
    95 	const TUint8* iNextPtr;
       
    96 	TBool iInContext;
       
    97 	};
       
    98 
       
    99 #endif