diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_extension_client_8cpp-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_extension_client_8cpp-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ - -
-00001 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). -00002 // All rights reserved. -00003 // This component and the accompanying materials are made available -00004 // under the terms of "Eclipse Public License v1.0" -00005 // which accompanies this distribution, and is available -00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00007 // -00008 // Initial Contributors: -00009 // Nokia Corporation - initial contribution. -00010 // -00011 // Contributors: -00012 // -00013 // Description: -00014 // Implements a simple console application to use functionality from both OriginalDll -00015 // and the ExtensionDll -00016 // Should work without rebuild for both versions of OriginalDll & ExtensionDll -00017 // -00018 -00019 #include <e32base.h> -00020 #include <e32cons.h> -00021 #include <NumberStore.h> -00022 -00023 _LIT(KHello,"Hello World!\r\n"); -00024 _LIT(KTxtEPOC32EX,"EPOC32EX"); -00025 _LIT(KTxtExampleCode,"Symbian platform Example Code"); -00026 _LIT(KFormatFailed,"failed: leave code=%d"); -00027 _LIT(KTxtOK,"ok"); -00028 _LIT(KTxtPressAnyKey," [press any key]"); -00029 -00030 LOCAL_D CConsoleBase* console; -00031 LOCAL_C void callExampleL(); -00032 LOCAL_C void doExampleL(); -00033 -00034 GLDEF_C TInt E32Main() -00035 { -00036 __UHEAP_MARK; -00037 CTrapCleanup* cleanup=CTrapCleanup::New(); -00038 TRAPD(error,callExampleL()); -00039 __ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error)); -00040 delete cleanup; -00041 __UHEAP_MARKEND; -00042 return 0; -00043 } -00044 -00045 LOCAL_C void callExampleL() -00046 { -00047 console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen)); -00048 CleanupStack::PushL(console); -00049 TRAPD(error,doExampleL()); -00050 if (error) -00051 console->Printf(KFormatFailed, error); -00052 else -00053 console->Printf(KTxtOK); -00054 console->Printf(KTxtPressAnyKey); -00055 console->Getch(); -00056 CleanupStack::PopAndDestroy(); -00057 } -00058 -00059 LOCAL_C void doExampleL() -00060 { -00061 console->Printf(KHello); -00062 TInt num1=3; -00063 TInt num2=7; -00064 -00065 //Create & initialise the number store using original functionality -00066 CNumberStore* numberstore=new (ELeave) CNumberStore(); -00067 numberstore->SetNumber1(num1); -00068 numberstore->SetNumber2(num2); -00069 console->Printf(_L("Created CNumberStore with values %d & %d\n"),num1,num2); -00070 num1=numberstore->Number1(); -00071 num2=numberstore->Number2(); -00072 console->Printf(_L("CNumberStore has values %d & %d\n"),num1,num2); -00073 -00074 TInt total=-1; -00075 TInt product=-1; -00076 -00077 //Use extension functionality -00078 -00079 //The following line will work as expected, using the implementation in the extension dll -00080 total=numberstore->AddNumbers(); -00081 -00082 //The following line will fail to compile, as it attempts to call a private function -00083 //product=numberstore->DoMultiplyNumbers(); -00084 -00085 //The following line will work as expected, using the implementation in the extension dll -00086 product=numberstore->MultiplyNumbers(); -00087 -00088 console->Printf(_L("CNumberStore extension gives total %d\n"),total); -00089 console->Printf(_L("CNumberStore extension gives product with magic multiplyer %d\n"),product); -00090 -00091 -00092 delete numberstore; -00093 } -