00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __CommonFramework_H
00018 #define __CommonFramework_H
00019
00020 #include <e32base.h>
00021 #include <e32cons.h>
00022
00023 _LIT(KTxtEPOC32EX,"EXAMPLES");
00024 _LIT(KTxtExampleCode,"Symbian platform Example Code");
00025 _LIT(KFormatFailed,"failed: leave code=%d");
00026 _LIT(KTxtOK,"ok");
00027 _LIT(KTxtPressAnyKey," [press any key]");
00028
00029
00030 LOCAL_D CConsoleBase* console;
00031 LOCAL_C void doExampleL();
00032
00033
00034 LOCAL_C void callExampleL();
00035
00036 GLDEF_C TInt E32Main()
00037 {
00038 __UHEAP_MARK;
00039 CTrapCleanup* cleanup=CTrapCleanup::New();
00040 TRAPD(error,callExampleL());
00041 __ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
00042 delete cleanup;
00043 __UHEAP_MARKEND;
00044 return 0;
00045 }
00046
00047 LOCAL_C void callExampleL()
00048 {
00049 console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
00050 CleanupStack::PushL(console);
00051 TRAPD(error,doExampleL());
00052 if (error)
00053 console->Printf(KFormatFailed, error);
00054 else
00055 console->Printf(KTxtOK);
00056 console->Printf(KTxtPressAnyKey);
00057 console->Getch();
00058 CleanupStack::PopAndDestroy();
00059 }
00060
00061 #endif