sbsv2/raptor/test/smoke_suite/test_resources/tracecompiler/TC_winscw/CommonFramework.h
changeset 591 22486c9c7b15
equal deleted inserted replaced
590:360bd6b35136 591:22486c9c7b15
       
     1 /*
       
     2 * Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CommonFramework_H
       
    21 #define __CommonFramework_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32cons.h>
       
    25 
       
    26 _LIT(KTxtEPOC32EX,"EXAMPLES");
       
    27 _LIT(KTxtExampleCode,"Symbian OS Example Code");
       
    28 _LIT(KFormatFailed,"failed: leave code=%d");
       
    29 _LIT(KTxtOK,"ok");
       
    30 _LIT(KTxtPressAnyKey," [press any key]");
       
    31 
       
    32 // public
       
    33 LOCAL_D CConsoleBase* console; // write all your messages to this
       
    34 LOCAL_C void doExampleL(); // code this function for the real example
       
    35 
       
    36 // private
       
    37 LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example
       
    38 
       
    39 GLDEF_C TInt E32Main() // main function called by E32
       
    40     {
       
    41 	__UHEAP_MARK;
       
    42 	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
       
    43 	TRAPD(error,callExampleL()); // more initialization, then do example
       
    44 	__ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
       
    45 	delete cleanup; // destroy clean-up stack
       
    46 	__UHEAP_MARKEND;
       
    47 	return 0; // and return
       
    48     }
       
    49 
       
    50 LOCAL_C void callExampleL() // initialize and call example code under cleanup stack
       
    51     {
       
    52 	console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
       
    53 	CleanupStack::PushL(console);
       
    54 	TRAPD(error,doExampleL()); // perform example function
       
    55 	if (error)
       
    56 		console->Printf(KFormatFailed, error);
       
    57 	else
       
    58 		console->Printf(KTxtOK);
       
    59 	console->Printf(KTxtPressAnyKey);
       
    60 	console->Getch(); // get and ignore character
       
    61 	CleanupStack::PopAndDestroy(); // close console
       
    62     }
       
    63 
       
    64 #endif