1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/Example/examplefourteen.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,135 @@
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 +// The implementation of CImplementationClassFourteen
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @internalComponent
1.24 +*/
1.25 +
1.26 +#include "examplefourteen.h"
1.27 +
1.28 +/**
1.29 + Intended Usage : Standardised safe construction which leaves nothing the cleanup stack.
1.30 + Error Condition : Leaves with error code.
1.31 + @leave KErrNoMemory.
1.32 + @param aInitParams The parameter struct used for initialising this object
1.33 + @return CImplementationClassFourteen* The class instance.
1.34 + @pre None
1.35 + @post CImplementationClassFourteen has been constructed,
1.36 + and initialised.
1.37 + */
1.38 +CImplementationClassFourteen* CImplementationClassFourteen::NewL(TAny* aInitParams)
1.39 + {
1.40 + CImplementationClassFourteen* self=new(ELeave) CImplementationClassFourteen();
1.41 + CleanupStack::PushL(self);
1.42 + self->ConstructL(aInitParams);
1.43 + CleanupStack::Pop(self);
1.44 + return self;
1.45 + }
1.46 +
1.47 +/**
1.48 + Intended Usage : Destructor of CImplementationClassFourteen
1.49 + Error Condition : None
1.50 + @pre CImplementationClassFourteen has been constructed
1.51 + @post CImplementationClassFourteen has been completely destroyed.
1.52 + */
1.53 +CImplementationClassFourteen::~CImplementationClassFourteen()
1.54 + {
1.55 + delete iInternalDescriptor;
1.56 + Dll::FreeTls();
1.57 + }
1.58 +/**
1.59 + Intended Usage : Default Constructor : usable only by derived classes
1.60 + Error Condition : None
1.61 + @pre None
1.62 + @post CImplementationClassFourteen has been constructed
1.63 + */
1.64 +CImplementationClassFourteen::CImplementationClassFourteen()
1.65 +: CExampleInterface()
1.66 + {
1.67 + }
1.68 +
1.69 +/**
1.70 + Intended Usage : Completes the safe construction of the CImplementationClassFourteen object
1.71 + Error Condition : Leaves with the error code.
1.72 + @leave KErrNoMemory.
1.73 + @param aInitParams The parameter struct used for initialising this object
1.74 + @pre CImplementationClassFourteen has been constructed
1.75 + @post CImplementationClassFourteen has been fully initialised.
1.76 + */
1.77 +void CImplementationClassFourteen::ConstructL(TAny* aInitParams)
1.78 + {
1.79 + TExampleInterfaceInitParams* params = REINTERPRET_CAST(TExampleInterfaceInitParams*, aInitParams);
1.80 + if(params)
1.81 + {
1.82 + if(params->descriptor)
1.83 + {
1.84 + iInternalDescriptor = params->descriptor->AllocL();
1.85 + }
1.86 + }
1.87 + User::LeaveIfError(Dll::SetTls(&iTLSInt));
1.88 + }
1.89 +
1.90 +/**
1.91 + Intended Usage : Overload of the pure interface method
1.92 + Representative of a method provided on
1.93 + the interface by the interface definer.
1.94 + @return None
1.95 + */
1.96 +void CImplementationClassFourteen::DoMethodL()
1.97 + {
1.98 + // Access TLS to ensure it has been set properly
1.99 + ASSERT(Dll::Tls()!=NULL);
1.100 + }
1.101 +
1.102 +/**
1.103 + Intended Usage : Overload of the pure interface method
1.104 + asynchronous function which
1.105 + an interface definer could specify.
1.106 + @return TInt KErrNone for success.
1.107 + */
1.108 +TInt CImplementationClassFourteen::FireAndForget()
1.109 + {
1.110 + return KErrNone;
1.111 + }
1.112 +
1.113 +// Provide the CActive overloads
1.114 +void CImplementationClassFourteen::RunL()
1.115 + {
1.116 + // Do nothing : should never be called
1.117 + __ASSERT_DEBUG(EFalse,User::Invariant());
1.118 + }
1.119 +
1.120 +void CImplementationClassFourteen::DoCancel()
1.121 + {
1.122 + // Do nothing
1.123 + }
1.124 +
1.125 +TInt CImplementationClassFourteen::RunError(TInt aError)
1.126 + {
1.127 + return aError;
1.128 + }
1.129 +/**
1.130 + Intended Usage : To verify the object returned by ECOM.
1.131 + @return TUid (ECOM's Implementation Uid for this class.)
1.132 + */
1.133 +TUid CImplementationClassFourteen::ImplId()
1.134 + {
1.135 + return KImplUid;
1.136 + }
1.137 +
1.138 +