lowlevellibsandfws/pluginfw/Framework/Example/Example16.cpp
changeset 0 e4d67989cc36
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lowlevellibsandfws/pluginfw/Framework/Example/Example16.cpp	Tue Feb 02 02:01:42 2010 +0200
@@ -0,0 +1,204 @@
+// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "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:
+//
+// Description:
+// The implementation of a some classes
+// to be provided by ECom.
+// 1. Using the CExampleInterface class as a base.
+// 
+//
+
+#include "Interface.h"
+#include "ImplementationProxy.h"
+#include "TestUtilities.h"	// For __FILE__LINE__
+
+// ____________________________________________________________________________
+// 
+/**
+	Intended usage: This class implements the functionality promised by 
+	the CExampleInterface defintion class. It does little apart from provides a test instance
+	which may be retrieved and run for testing purposes.
+	Its resolution is based upon its registered default data string that
+	advertises this class as being able to handle 'text\wml' data.
+	@since 7.0
+ */
+class CImplementationClass16 : public CExampleInterface
+{
+// Methods
+public:
+/**
+	@fn				NewL(TAny* aInitParams)
+	Intended Usage	: Standardised safe construction which leaves nothing the cleanup stack.
+	Error Condition	: Leaves with error code.
+	@leave          KErrNoMemory.
+	@since			7.0
+	@param			aInitParams The parameter struct used for initialising this object
+	@return			CImplementationClass16* The class instance.
+	@pre 			None
+	@post			CImplementationClass16 has been constructed,
+					and initialised.
+ */
+	static void NewL();
+
+/**
+	@fn				~CImplementationClass16()
+	Intended Usage	: Default Destructor	
+	Error Condition	: None	
+	@since			7.0
+	@pre 			CImplementationClass16 has been constructed
+	@post			CImplementationClass16 has been completely destroyed.
+ */
+	virtual ~CImplementationClass16();
+
+/**
+	@fn				DoMethodL()
+	Intended Usage	: Overload of the pure interface method
+					Representative of a method provided on 
+					the interface by the interface definer.
+	Error Condition	: Leaves with an error code.
+	@leave  		KErrNoMemory, KErrNotSupported.
+	@since			7.0
+	@return			None
+	@pre 			CImplementationClass16 has been constructed
+	@post			Unspecified
+ */	
+	void DoMethodL();
+
+
+ /**
+	@fn				ImplId()
+	Intended Usage	: To verify the object returned by ECOM.
+	Error Condition	: None.
+	@since			7.0
+	@return			TUid (ECOM's Implementation Uid for this class.)
+	@pre 			CImplementationClassThree has been constructed
+	@post			Unspecified
+ */
+	TUid ImplId();
+
+private:
+/**
+	@fn				CImplementationClass16()
+	Intended Usage	: Default Constructor : usable only by derived classes	
+	Error Condition	: None	
+	@since			7.0
+	@pre 			None
+	@post			CImplementationClass16 has been constructed
+ */
+	CImplementationClass16();
+
+/**
+	@fn				ConstructL()
+	Intended Usage	: Completes the safe construction of the CImplementationClass16 object
+	Error Condition	: Leaves with the error code.	
+	@leave          KErrNoMemory.	
+	@since			7.0
+	@pre 			CImplementationClass16 has been constructed
+	@post			CImplementationClass16 has been fully initialised.
+ */
+	void ConstructL();
+
+// Provide the CActive overloads
+	void RunL();
+	void DoCancel();
+	TInt RunError(TInt aError);
+
+private:
+/** A place for allocating some memory in the ConstructL */
+	HBufC*	iInternalDescriptor;
+/** An int to be stored in TLS to test its useage */	
+	TInt	iTLSInt;
+
+};  // End of CImplementationClass16 definition
+
+// __________________________________________________________________________
+// Implementation
+
+void CImplementationClass16::NewL()
+// Intended Usage	: Safe construction which leaves nothing upon the cleanup stack	
+// Error Condition	: Will leave with an appropriate error code	
+// Dependencies	: CBase
+// @param			" "
+// @return			CImplementationClass16* a pointer to the fully instantiated CImplementationClass16 object
+// @pre 			None
+// @post			The object has been fully instantiated
+// Static member
+	{
+	User::Leave(KErrGeneral);
+	}
+
+CImplementationClass16::~CImplementationClass16()
+// Default virtual d'tor
+	{
+	delete iInternalDescriptor;
+	}
+
+CImplementationClass16::CImplementationClass16()
+// Default c'tor for use by derived and 
+// static construction methods only
+: CExampleInterface()
+	{
+	// Deliberately do nothing here : See ConstructL() for initialisation completion.
+	}
+
+void CImplementationClass16::ConstructL()
+// Intended Usage	: Safely complete the initialization of the constructed object	
+// Error Condition	: Will leave with an appropriate error code	
+// Dependencies	: CBase
+// @return			void
+// @pre 			CImplementationClass16 has been constructed
+// @post			The CImplementationClass16 object has been fully instantiated
+//
+	{
+	}
+
+void CImplementationClass16::DoMethodL()
+	{
+	}
+
+// Provide the CActive overloads
+void CImplementationClass16::RunL()
+	{
+	// Do nothing : should never be called
+	__ASSERT_DEBUG(EFalse,User::Invariant());
+	}
+
+void CImplementationClass16::DoCancel()
+	{
+	// Do nothing
+	}
+
+TInt CImplementationClass16::RunError(TInt /*aError*/)
+	{
+	return KErrNone;
+	}
+
+TUid CImplementationClass16::ImplId()
+	{
+	TUid idVal = {0x10009E4A};
+	return (idVal);
+	}
+
+// __________________________________________________________________________
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+	{
+		IMPLEMENTATION_PROXY_ENTRY(0x10009DDC,	CImplementationClass16::NewL)
+	};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+	return ImplementationTable;
+	}
+