os/ossrv/lowlevellibsandfws/pluginfw/Framework/Example/exampletwelve.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/Example/exampletwelve.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,191 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// ExampleTweleve.h
    1.18 +// The definition of some classes to be provided by ECom.
    1.19 +// 1. Using the CExampleInterface class as a base.
    1.20 +// 2. Example of how extended interfaces could work.
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +/**
    1.25 + @file
    1.26 + @internalComponent
    1.27 +*/
    1.28 +
    1.29 +#include "Interface.h"
    1.30 +//#include "ImplementationProxy.h"
    1.31 +#include "TestUtilities.h"	// For __FILE__LINE__
    1.32 +#include "ExtendedInterfaceImplementationProxy.h"
    1.33 +
    1.34 +const TUid KImplUid1 = {0x10009E39};
    1.35 +const TUid KImplUid2 = {0x10009E3C};
    1.36 +const TUid KImplUid3 = {0x10009E3D};
    1.37 +
    1.38 +// ____________________________________________________________________________
    1.39 +// Class CImplementationClassTwelve
    1.40 +//
    1.41 +/**
    1.42 +	Intended usage: This class implements the functionality promised by
    1.43 +	the CExampleInterface and MExampleInterfaceExtended definition classes. 
    1.44 +	It does little apart from provides a test instance
    1.45 +	which may be retrieved and run for testing purposes. This is an example of
    1.46 +	how extended interface is implemented in the same class as the original and 
    1.47 +	how to get/release the extended interface which is implemented in different class.
    1.48 + */
    1.49 +class CImplementationClassTwelve : public CExampleInterface, public MExampleInterfaceExtended
    1.50 +{
    1.51 +// Methods
    1.52 +public:
    1.53 +	static CImplementationClassTwelve* NewL(TAny* aInitParams);
    1.54 +	virtual ~CImplementationClassTwelve();
    1.55 +	void DoMethodL();
    1.56 +	TInt FireAndForget();
    1.57 +	TUid ImplId();
    1.58 +	virtual void DoMethodExtended();  //from MExampleInterfaceExtended
    1.59 +	static TAny* GetExtendedInterfaceL(TAny* aObject,const TUid& aExtendedInterface,TUint32& aBitFlags,TAny*& releaseObject);
    1.60 +	static void ReleaseExtendedInterface(TAny* aObject,const TUid& aInterface);
    1.61 +private:
    1.62 +	CImplementationClassTwelve();
    1.63 +	void ConstructL(TAny* aInitParams);
    1.64 +// Provide the CActive overloads
    1.65 +	void RunL();
    1.66 +	void DoCancel();
    1.67 +	TInt RunError(TInt aError);
    1.68 +private:
    1.69 +/** A place for allocating some memory in the ConstructL */
    1.70 +	HBufC*	iInternalDescriptor;
    1.71 +/** An int to be stored in TLS to test its useage */
    1.72 +	TInt	iTLSInt;
    1.73 +/** Uid of the extended interface */
    1.74 +	TUid iExtendedInterfaceUid;		
    1.75 +};  // End of CImplementationClassTwelve definition
    1.76 +
    1.77 +// ____________________________________________________________________________
    1.78 +// Class CImplementationClassTwelveExtended
    1.79 +//
    1.80 +/**
    1.81 +	Intended usage: This class implements the functionality promised by
    1.82 +	the MExampleInterfaceExtended2 definition class. This is an extended interface of
    1.83 +	CImplementationClassTwelve. This is a sample extended interface that is
    1.84 +	separate from the main interface. This extended interface does nothing, but shows
    1.85 +    how one can set up a separately instantiated extended interface.
    1.86 + */
    1.87 +class CImplementationClassTwelveExtended : public CBase, public MExampleInterfaceExtended2
    1.88 +{
    1.89 +// Methods
    1.90 +public:
    1.91 +	static CImplementationClassTwelveExtended* NewL();
    1.92 +	virtual ~CImplementationClassTwelveExtended();
    1.93 +	virtual void DoMethodExtended2();  //from MExampleInterfaceExtended2
    1.94 +private:
    1.95 +	CImplementationClassTwelveExtended();
    1.96 +// Attribute
    1.97 +private:
    1.98 +	TUid iExtendedInterfaceUid;		
    1.99 +};  // End of CImplementationClassTwelveExtended definition
   1.100 +
   1.101 +// ____________________________________________________________________________
   1.102 +// Class CImplementationClassTwelveExtended2
   1.103 +//
   1.104 +/**
   1.105 +	Intended usage: This class implements the functionality promised by
   1.106 +	the MExampleInterfaceExtended2 definition class. This is an extended interface of
   1.107 +	CImplementationClassTwelve. It is the same as CImplementationClassTwelveExtended,
   1.108 +	but just shows that it is possible to have multiple extended interfaces in one implementation.
   1.109 + */
   1.110 +class CImplementationClassTwelveExtended2 : public CBase, public MExampleInterfaceExtended2
   1.111 +{
   1.112 +// Methods
   1.113 +public:
   1.114 +	static CImplementationClassTwelveExtended2* NewL();
   1.115 +	virtual ~CImplementationClassTwelveExtended2();
   1.116 +	virtual void DoMethodExtended2(); //from MExampleInterfaceExtended2
   1.117 +private:
   1.118 +	CImplementationClassTwelveExtended2();
   1.119 +// Attribute
   1.120 +private:
   1.121 +	TUid iExtendedInterfaceUid;		
   1.122 +};  // End of CImplementationClassTwelveExtended2 definition
   1.123 +
   1.124 +
   1.125 +// ____________________________________________________________________________
   1.126 +// Class CImplementationClassTwelveBasic
   1.127 +//
   1.128 +/**
   1.129 +This class implements the functionality promised by
   1.130 +the CExampleInterface definition class. It does little apart from provides a test instance
   1.131 +which may be retrieved and run for testing purposes. This is an example that no extended interface 
   1.132 +is implemented in this class.
   1.133 + */
   1.134 +class CImplementationClassTwelveBasic : public CExampleInterface
   1.135 +{
   1.136 +// Methods
   1.137 +public:
   1.138 +	static CImplementationClassTwelveBasic* NewL(TAny* aInitParams);
   1.139 +	virtual ~CImplementationClassTwelveBasic();
   1.140 +	void DoMethodL();
   1.141 +	TInt FireAndForget();
   1.142 +	TUid ImplId();
   1.143 +private:
   1.144 +	CImplementationClassTwelveBasic();
   1.145 +	void ConstructL(TAny* aInitParams);
   1.146 +	// Provide the CActive overloads
   1.147 +	void RunL();
   1.148 +	void DoCancel();
   1.149 +	TInt RunError(TInt aError);
   1.150 +private:
   1.151 +/** A place for allocating some memory in the ConstructL */
   1.152 +	HBufC*	iInternalDescriptor;
   1.153 +/** An int to be stored in TLS to test its usage */
   1.154 +	TInt	iTLSInt;
   1.155 +
   1.156 +};  // End of CImplementationClassTwelveBasic definition
   1.157 +
   1.158 +// ____________________________________________________________________________
   1.159 +// Class CImplementationClassTwelve2
   1.160 +//
   1.161 +/**
   1.162 +Intended usage: This class implements the functionality promised by
   1.163 +the CExampleInterface definition class. It does little apart from provides a test instance
   1.164 +which may be retrieved and run for testing purposes.This is an example of
   1.165 +how extended interface is implemented in the same class as the original
   1.166 + */
   1.167 +class CImplementationClassTwelve2 : public CExampleInterface, public MExampleInterfaceExtended
   1.168 +{
   1.169 +// Methods
   1.170 +public:
   1.171 +	static CImplementationClassTwelve2* NewL(TAny* aInitParams);
   1.172 +	virtual ~CImplementationClassTwelve2();
   1.173 +	void DoMethodL();
   1.174 +	TInt FireAndForget();
   1.175 +	TUid ImplId();
   1.176 +	static TAny* GetExtendedInterfaceL(TAny* aObject,const TUid& aExtendedInterface,TUint32& aBitFlags,TAny*& releaseObject);
   1.177 + public: 
   1.178 +	virtual void DoMethodExtended(); // From MExampleInterfaceExtended
   1.179 +private:
   1.180 +	CImplementationClassTwelve2();
   1.181 +	void ConstructL(TAny* aInitParams);
   1.182 +// Provide the CActive overloads
   1.183 +	void RunL();
   1.184 +	void DoCancel();
   1.185 +	TInt RunError(TInt aError);
   1.186 +private:
   1.187 +/** A place for allocating some memory in the ConstructL */
   1.188 +	HBufC*	iInternalDescriptor;
   1.189 +/** An int to be stored in TLS to test its useage */
   1.190 +	TInt	iTLSInt;
   1.191 +/** Uid of the extended interface */
   1.192 +	TUid iExtendedInterfaceUid;			
   1.193 +};  // End of CImplementationClassTwelve2 definition
   1.194 +