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