testexecfw/stf/examples/MigrationExample/FileStore/TEF_BLOCK/inc/CTestFileServerWrapper.h
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CTESTFILESERVERWRAPPER_H__
       
    19 #define __CTESTFILESERVERWRAPPER_H__
       
    20 
       
    21 #include <DataWrapper.h>
       
    22 
       
    23 class CTestFileServerWrapper : public CDataWrapper
       
    24 	{
       
    25 public:
       
    26 	// Default Constructor
       
    27 	CTestFileServerWrapper();
       
    28 	// Default Destructor
       
    29 	~CTestFileServerWrapper();
       
    30 
       
    31 	// Two-Phase Constructor
       
    32 	static CTestFileServerWrapper* NewL();
       
    33 
       
    34 	// Command Dispatcher
       
    35 	virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
       
    36 
       
    37 	// Getter for the wrapped object
       
    38 	virtual TAny* GetObject() { return iObject; }
       
    39 
       
    40 	// Setter for the wrapped object
       
    41 	inline virtual void SetObjectL(TAny* aObject)
       
    42 		{
       
    43 		delete iObject;
       
    44 		iObject = NULL;
       
    45 		iObject = static_cast<CTestFileServerWrapper*> (aObject);
       
    46 		}
       
    47 	
       
    48 
       
    49 	// Asynchronous Run
       
    50 	void RunL(CActive* aActive, TInt aIndex);
       
    51 	
       
    52     inline virtual void DisownObjectL() 
       
    53         {
       
    54         iObject = NULL;
       
    55         }
       
    56     inline virtual TCleanupOperation CleanupOperation()
       
    57         {
       
    58         return CleanupOperation;
       
    59         }
       
    60 
       
    61 protected:
       
    62 	void ConstructL();
       
    63 
       
    64 private:
       
    65 	// Testing CTestFileServer::CreateFile
       
    66 	inline void DoCmdCreateFile(const TDesC& aSection);
       
    67 
       
    68 	// Testing CTestFileServer::ReadFile
       
    69 	inline void DoCmdReadFile(const TDesC& aSection);
       
    70 	
       
    71 	inline void DoCmdPanicExample(const TDesC& aSection);
       
    72 	
       
    73     static void CleanupOperation(TAny* aAny)
       
    74         {
       
    75         CTestFileServerWrapper* myObject = static_cast<CTestFileServerWrapper*>(aAny);
       
    76         delete myObject;
       
    77         }	
       
    78 
       
    79 
       
    80 private:
       
    81 	CActiveCallback* iActiveCallback;
       
    82 	TAny* iObject;
       
    83 	};
       
    84 #endif // __CTESTFILESERVERWRAPPER_H__