1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/Example/Example16.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,204 @@
1.4 +// Copyright (c) 1997-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 +// The implementation of a some classes
1.18 +// to be provided by ECom.
1.19 +// 1. Using the CExampleInterface class as a base.
1.20 +//
1.21 +//
1.22 +
1.23 +#include "Interface.h"
1.24 +#include "ImplementationProxy.h"
1.25 +#include "TestUtilities.h" // For __FILE__LINE__
1.26 +
1.27 +// ____________________________________________________________________________
1.28 +//
1.29 +/**
1.30 + Intended usage: This class implements the functionality promised by
1.31 + the CExampleInterface defintion class. It does little apart from provides a test instance
1.32 + which may be retrieved and run for testing purposes.
1.33 + Its resolution is based upon its registered default data string that
1.34 + advertises this class as being able to handle 'text\wml' data.
1.35 + @since 7.0
1.36 + */
1.37 +class CImplementationClass16 : public CExampleInterface
1.38 +{
1.39 +// Methods
1.40 +public:
1.41 +/**
1.42 + @fn NewL(TAny* aInitParams)
1.43 + Intended Usage : Standardised safe construction which leaves nothing the cleanup stack.
1.44 + Error Condition : Leaves with error code.
1.45 + @leave KErrNoMemory.
1.46 + @since 7.0
1.47 + @param aInitParams The parameter struct used for initialising this object
1.48 + @return CImplementationClass16* The class instance.
1.49 + @pre None
1.50 + @post CImplementationClass16 has been constructed,
1.51 + and initialised.
1.52 + */
1.53 + static void NewL();
1.54 +
1.55 +/**
1.56 + @fn ~CImplementationClass16()
1.57 + Intended Usage : Default Destructor
1.58 + Error Condition : None
1.59 + @since 7.0
1.60 + @pre CImplementationClass16 has been constructed
1.61 + @post CImplementationClass16 has been completely destroyed.
1.62 + */
1.63 + virtual ~CImplementationClass16();
1.64 +
1.65 +/**
1.66 + @fn DoMethodL()
1.67 + Intended Usage : Overload of the pure interface method
1.68 + Representative of a method provided on
1.69 + the interface by the interface definer.
1.70 + Error Condition : Leaves with an error code.
1.71 + @leave KErrNoMemory, KErrNotSupported.
1.72 + @since 7.0
1.73 + @return None
1.74 + @pre CImplementationClass16 has been constructed
1.75 + @post Unspecified
1.76 + */
1.77 + void DoMethodL();
1.78 +
1.79 +
1.80 + /**
1.81 + @fn ImplId()
1.82 + Intended Usage : To verify the object returned by ECOM.
1.83 + Error Condition : None.
1.84 + @since 7.0
1.85 + @return TUid (ECOM's Implementation Uid for this class.)
1.86 + @pre CImplementationClassThree has been constructed
1.87 + @post Unspecified
1.88 + */
1.89 + TUid ImplId();
1.90 +
1.91 +private:
1.92 +/**
1.93 + @fn CImplementationClass16()
1.94 + Intended Usage : Default Constructor : usable only by derived classes
1.95 + Error Condition : None
1.96 + @since 7.0
1.97 + @pre None
1.98 + @post CImplementationClass16 has been constructed
1.99 + */
1.100 + CImplementationClass16();
1.101 +
1.102 +/**
1.103 + @fn ConstructL()
1.104 + Intended Usage : Completes the safe construction of the CImplementationClass16 object
1.105 + Error Condition : Leaves with the error code.
1.106 + @leave KErrNoMemory.
1.107 + @since 7.0
1.108 + @pre CImplementationClass16 has been constructed
1.109 + @post CImplementationClass16 has been fully initialised.
1.110 + */
1.111 + void ConstructL();
1.112 +
1.113 +// Provide the CActive overloads
1.114 + void RunL();
1.115 + void DoCancel();
1.116 + TInt RunError(TInt aError);
1.117 +
1.118 +private:
1.119 +/** A place for allocating some memory in the ConstructL */
1.120 + HBufC* iInternalDescriptor;
1.121 +/** An int to be stored in TLS to test its useage */
1.122 + TInt iTLSInt;
1.123 +
1.124 +}; // End of CImplementationClass16 definition
1.125 +
1.126 +// __________________________________________________________________________
1.127 +// Implementation
1.128 +
1.129 +void CImplementationClass16::NewL()
1.130 +// Intended Usage : Safe construction which leaves nothing upon the cleanup stack
1.131 +// Error Condition : Will leave with an appropriate error code
1.132 +// Dependencies : CBase
1.133 +// @param " "
1.134 +// @return CImplementationClass16* a pointer to the fully instantiated CImplementationClass16 object
1.135 +// @pre None
1.136 +// @post The object has been fully instantiated
1.137 +// Static member
1.138 + {
1.139 + User::Leave(KErrGeneral);
1.140 + }
1.141 +
1.142 +CImplementationClass16::~CImplementationClass16()
1.143 +// Default virtual d'tor
1.144 + {
1.145 + delete iInternalDescriptor;
1.146 + }
1.147 +
1.148 +CImplementationClass16::CImplementationClass16()
1.149 +// Default c'tor for use by derived and
1.150 +// static construction methods only
1.151 +: CExampleInterface()
1.152 + {
1.153 + // Deliberately do nothing here : See ConstructL() for initialisation completion.
1.154 + }
1.155 +
1.156 +void CImplementationClass16::ConstructL()
1.157 +// Intended Usage : Safely complete the initialization of the constructed object
1.158 +// Error Condition : Will leave with an appropriate error code
1.159 +// Dependencies : CBase
1.160 +// @return void
1.161 +// @pre CImplementationClass16 has been constructed
1.162 +// @post The CImplementationClass16 object has been fully instantiated
1.163 +//
1.164 + {
1.165 + }
1.166 +
1.167 +void CImplementationClass16::DoMethodL()
1.168 + {
1.169 + }
1.170 +
1.171 +// Provide the CActive overloads
1.172 +void CImplementationClass16::RunL()
1.173 + {
1.174 + // Do nothing : should never be called
1.175 + __ASSERT_DEBUG(EFalse,User::Invariant());
1.176 + }
1.177 +
1.178 +void CImplementationClass16::DoCancel()
1.179 + {
1.180 + // Do nothing
1.181 + }
1.182 +
1.183 +TInt CImplementationClass16::RunError(TInt /*aError*/)
1.184 + {
1.185 + return KErrNone;
1.186 + }
1.187 +
1.188 +TUid CImplementationClass16::ImplId()
1.189 + {
1.190 + TUid idVal = {0x10009E4A};
1.191 + return (idVal);
1.192 + }
1.193 +
1.194 +// __________________________________________________________________________
1.195 +// Exported proxy for instantiation method resolution
1.196 +// Define the interface UIDs
1.197 +const TImplementationProxy ImplementationTable[] =
1.198 + {
1.199 + IMPLEMENTATION_PROXY_ENTRY(0x10009DDC, CImplementationClass16::NewL)
1.200 + };
1.201 +
1.202 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
1.203 + {
1.204 + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
1.205 + return ImplementationTable;
1.206 + }
1.207 +