Initial contribution of the Adaptation Documentation.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-E4E656BF-E5F7-5125-AE88-60C3E9FCF0D2" xml:lang="en"><title>InterfaceDefinition: ECom Interface Definition Example Code</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-B84E1E5E-7141-52D2-A589-35F334058DE5"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-4d91db5b-1dd7-43ba-9ce8-1c2a1f08a120.zip" scope="external">Ecom.zip</xref></p>Download some additional files
required by the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-89fa6105-e749-4e5f-a233-a000e3b9390b.zip" scope="external">CommonFramework</xref><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-4d91db5b-1dd7-43ba-9ce8-1c2a1f08a120.html" scope="peer">browse</xref> to view the example code. </p>View the
additional files: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-89fa6105-e749-4e5f-a233-a000e3b9390b.html" scope="peer">browse</xref>. </section>
<section id="GUID-F68E5509-F824-43CE-ADC1-EEFFEAAE2A84"><title>Description</title> <p> <filepath>InterfaceDefinition</filepath> provides an example
ECom interface definition. It declares a base class, <codeph>CExampleInterface</codeph>, from which implementations of the interface should derive. </p> <p> <codeph>CExampleInterface</codeph> provides three <codeph>NewL()</codeph> functions that allow clients to get respectively: </p> <ul>
<li id="GUID-C512F948-599C-5C46-AB2B-14348DFFD02A"><p>the default
implementation of the interface, using a specified custom resolver
to determine what is the default </p> </li>
<li id="GUID-2B3B6E81-296C-554C-BB18-BCF54121C26F"><p>an implementation
determined by the default resolver, using a specified string as a
resolution parameter </p> </li>
<li id="GUID-F0FD51DC-CC1D-5D27-ABFE-9381A168E996"><p>an implementation
determined by the default resolver, using a specified string as a
resolution parameter, and passing some data to the implementation </p> </li>
</ul> <p> <codeph>CExampleInterface</codeph> uses the overloads of <xref href="GUID-1344F049-81C4-3D17-AF46-8B5584680ADB.dita#GUID-1344F049-81C4-3D17-AF46-8B5584680ADB/GUID-ECFBCF8D-E372-36CD-8B60-0CFDBE01833E"><apiname>REComSession::CreateImplementation(TUid, TUid &)</apiname></xref> to
implement these functions. </p> <p> <codeph>CExampleInterface</codeph> declares one pure virtual function, <codeph>DoMethodL()</codeph>, which supplies a service to the client. Implementations must implement
this function. </p> <p> <filepath>InterfaceDefinition</filepath> also provides an example of a custom resolver, called <codeph>CExampleResolver</codeph>. Its behaviour is the same as ECom's default resolver. Because a
resolver is an implementation of the ECom <codeph>CResolver</codeph> interface, it requires a registration resource file (<filepath>100098ea.rss</filepath>), and an exported factory table (<filepath>Proxy.cpp</filepath>). </p> </section>
<section id="GUID-17AD128E-AAF6-4AEB-B423-EE6B17AC843B"><title>Class
Summary</title><p><xref href="GUID-1344F049-81C4-3D17-AF46-8B5584680ADB.dita"><apiname>REComSession</apiname></xref></p><p><xref href="GUID-6E3118A3-4CE5-32AD-9C73-5CDD7B54D9EC.dita"><apiname>TEComResolverParams</apiname></xref></p><p><xref href="GUID-DABE7E22-BDF6-3A2E-99F1-3453706A694E.dita"><apiname>RImplInfoPtrArray</apiname></xref></p><p><xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita"><apiname>CResolver</apiname></xref></p></section>
<section id="GUID-BDC71AA8-C20C-44CE-9D96-A79EED13E2BA"><title>Usage</title> <p>Building <filepath>InterfaceDefinition</filepath> exports the
files that contain the interface definition, <filepath>Interface.h</filepath> and <filepath>Interface.inl</filepath>, to <filepath>epoc32\include\</filepath>; produces a DLL <filepath>ExampleResolver.dll</filepath>; and compiles
a resource file <filepath>ExampleResolver.rsc</filepath> in the <filepath>\resource\plugins\</filepath> directory. </p> <p>Implementations
of the interface are provided in the <xref href="GUID-711C387D-E10C-5469-872A-5B2BDACC9B91.dita">Interface Implementation</xref> example. </p> <p>A client program that accesses the interface is
provided in the <xref href="GUID-7B4A78D8-64BB-550E-ABC0-255312351215.dita">Interface Client</xref>example. </p> </section>
</conbody></concept>