os/ossrv/lowlevellibsandfws/pluginfw/Framework/Example/exampletwelve.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // ExampleTweleve.h
    15 // The definition of some classes to be provided by ECom.
    16 // 1. Using the CExampleInterface class as a base.
    17 // 2. Example of how extended interfaces could work.
    18 // 
    19 //
    20 
    21 /**
    22  @file
    23  @internalComponent
    24 */
    25 
    26 #include "Interface.h"
    27 //#include "ImplementationProxy.h"
    28 #include "TestUtilities.h"	// For __FILE__LINE__
    29 #include "ExtendedInterfaceImplementationProxy.h"
    30 
    31 const TUid KImplUid1 = {0x10009E39};
    32 const TUid KImplUid2 = {0x10009E3C};
    33 const TUid KImplUid3 = {0x10009E3D};
    34 
    35 // ____________________________________________________________________________
    36 // Class CImplementationClassTwelve
    37 //
    38 /**
    39 	Intended usage: This class implements the functionality promised by
    40 	the CExampleInterface and MExampleInterfaceExtended definition classes. 
    41 	It does little apart from provides a test instance
    42 	which may be retrieved and run for testing purposes. This is an example of
    43 	how extended interface is implemented in the same class as the original and 
    44 	how to get/release the extended interface which is implemented in different class.
    45  */
    46 class CImplementationClassTwelve : public CExampleInterface, public MExampleInterfaceExtended
    47 {
    48 // Methods
    49 public:
    50 	static CImplementationClassTwelve* NewL(TAny* aInitParams);
    51 	virtual ~CImplementationClassTwelve();
    52 	void DoMethodL();
    53 	TInt FireAndForget();
    54 	TUid ImplId();
    55 	virtual void DoMethodExtended();  //from MExampleInterfaceExtended
    56 	static TAny* GetExtendedInterfaceL(TAny* aObject,const TUid& aExtendedInterface,TUint32& aBitFlags,TAny*& releaseObject);
    57 	static void ReleaseExtendedInterface(TAny* aObject,const TUid& aInterface);
    58 private:
    59 	CImplementationClassTwelve();
    60 	void ConstructL(TAny* aInitParams);
    61 // Provide the CActive overloads
    62 	void RunL();
    63 	void DoCancel();
    64 	TInt RunError(TInt aError);
    65 private:
    66 /** A place for allocating some memory in the ConstructL */
    67 	HBufC*	iInternalDescriptor;
    68 /** An int to be stored in TLS to test its useage */
    69 	TInt	iTLSInt;
    70 /** Uid of the extended interface */
    71 	TUid iExtendedInterfaceUid;		
    72 };  // End of CImplementationClassTwelve definition
    73 
    74 // ____________________________________________________________________________
    75 // Class CImplementationClassTwelveExtended
    76 //
    77 /**
    78 	Intended usage: This class implements the functionality promised by
    79 	the MExampleInterfaceExtended2 definition class. This is an extended interface of
    80 	CImplementationClassTwelve. This is a sample extended interface that is
    81 	separate from the main interface. This extended interface does nothing, but shows
    82     how one can set up a separately instantiated extended interface.
    83  */
    84 class CImplementationClassTwelveExtended : public CBase, public MExampleInterfaceExtended2
    85 {
    86 // Methods
    87 public:
    88 	static CImplementationClassTwelveExtended* NewL();
    89 	virtual ~CImplementationClassTwelveExtended();
    90 	virtual void DoMethodExtended2();  //from MExampleInterfaceExtended2
    91 private:
    92 	CImplementationClassTwelveExtended();
    93 // Attribute
    94 private:
    95 	TUid iExtendedInterfaceUid;		
    96 };  // End of CImplementationClassTwelveExtended definition
    97 
    98 // ____________________________________________________________________________
    99 // Class CImplementationClassTwelveExtended2
   100 //
   101 /**
   102 	Intended usage: This class implements the functionality promised by
   103 	the MExampleInterfaceExtended2 definition class. This is an extended interface of
   104 	CImplementationClassTwelve. It is the same as CImplementationClassTwelveExtended,
   105 	but just shows that it is possible to have multiple extended interfaces in one implementation.
   106  */
   107 class CImplementationClassTwelveExtended2 : public CBase, public MExampleInterfaceExtended2
   108 {
   109 // Methods
   110 public:
   111 	static CImplementationClassTwelveExtended2* NewL();
   112 	virtual ~CImplementationClassTwelveExtended2();
   113 	virtual void DoMethodExtended2(); //from MExampleInterfaceExtended2
   114 private:
   115 	CImplementationClassTwelveExtended2();
   116 // Attribute
   117 private:
   118 	TUid iExtendedInterfaceUid;		
   119 };  // End of CImplementationClassTwelveExtended2 definition
   120 
   121 
   122 // ____________________________________________________________________________
   123 // Class CImplementationClassTwelveBasic
   124 //
   125 /**
   126 This class implements the functionality promised by
   127 the CExampleInterface definition class. It does little apart from provides a test instance
   128 which may be retrieved and run for testing purposes. This is an example that no extended interface 
   129 is implemented in this class.
   130  */
   131 class CImplementationClassTwelveBasic : public CExampleInterface
   132 {
   133 // Methods
   134 public:
   135 	static CImplementationClassTwelveBasic* NewL(TAny* aInitParams);
   136 	virtual ~CImplementationClassTwelveBasic();
   137 	void DoMethodL();
   138 	TInt FireAndForget();
   139 	TUid ImplId();
   140 private:
   141 	CImplementationClassTwelveBasic();
   142 	void ConstructL(TAny* aInitParams);
   143 	// Provide the CActive overloads
   144 	void RunL();
   145 	void DoCancel();
   146 	TInt RunError(TInt aError);
   147 private:
   148 /** A place for allocating some memory in the ConstructL */
   149 	HBufC*	iInternalDescriptor;
   150 /** An int to be stored in TLS to test its usage */
   151 	TInt	iTLSInt;
   152 
   153 };  // End of CImplementationClassTwelveBasic definition
   154 
   155 // ____________________________________________________________________________
   156 // Class CImplementationClassTwelve2
   157 //
   158 /**
   159 Intended usage: This class implements the functionality promised by
   160 the CExampleInterface definition class. It does little apart from provides a test instance
   161 which may be retrieved and run for testing purposes.This is an example of
   162 how extended interface is implemented in the same class as the original
   163  */
   164 class CImplementationClassTwelve2 : public CExampleInterface, public MExampleInterfaceExtended
   165 {
   166 // Methods
   167 public:
   168 	static CImplementationClassTwelve2* NewL(TAny* aInitParams);
   169 	virtual ~CImplementationClassTwelve2();
   170 	void DoMethodL();
   171 	TInt FireAndForget();
   172 	TUid ImplId();
   173 	static TAny* GetExtendedInterfaceL(TAny* aObject,const TUid& aExtendedInterface,TUint32& aBitFlags,TAny*& releaseObject);
   174  public: 
   175 	virtual void DoMethodExtended(); // From MExampleInterfaceExtended
   176 private:
   177 	CImplementationClassTwelve2();
   178 	void ConstructL(TAny* aInitParams);
   179 // Provide the CActive overloads
   180 	void RunL();
   181 	void DoCancel();
   182 	TInt RunError(TInt aError);
   183 private:
   184 /** A place for allocating some memory in the ConstructL */
   185 	HBufC*	iInternalDescriptor;
   186 /** An int to be stored in TLS to test its useage */
   187 	TInt	iTLSInt;
   188 /** Uid of the extended interface */
   189 	TUid iExtendedInterfaceUid;			
   190 };  // End of CImplementationClassTwelve2 definition
   191