localisation/apparchitecture/tef/TNonNative/TNNApp2.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent - Internal Symbian test code  
       
    21 */
       
    22 
       
    23 
       
    24 #include <E32STD.H>
       
    25 #include <E32BASE.H>
       
    26 #include <E32PROPERTY.H>
       
    27 #include <APACMDLN.H>
       
    28 #include <APAID.H>
       
    29 #include <APGCLI.H>
       
    30 #include <APGICNFL.H>
       
    31 #include <APMSTD.H>
       
    32 
       
    33 const TUint KPropertyCategory=0x101F289C;
       
    34 const TUint KPropertyKey=0;
       
    35 
       
    36 _LIT(KLitExtension, ".NNAPP2");
       
    37 
       
    38 inline void DoTest(TBool aCondition) {__ASSERT_ALWAYS(aCondition, User::Invariant());}
       
    39 
       
    40 // top-level functions
       
    41 
       
    42 LOCAL_C void MainL()
       
    43 	{
       
    44 	CApaCommandLine* commandLine=NULL;
       
    45 	User::LeaveIfError(CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine));
       
    46 	CleanupStack::PushL(commandLine);
       
    47 	const TPtrC executableName(commandLine->ExecutableName());
       
    48 	DoTest(TParsePtrC(executableName).Ext().CompareF(KLitExtension)==0);
       
    49 	User::LeaveIfError(RProperty::Set(TUid::Uid(KPropertyCategory), KPropertyKey, commandLine->DocumentName()));
       
    50 	CleanupStack::PopAndDestroy(commandLine);
       
    51 	}
       
    52 
       
    53 GLDEF_C TInt E32Main()
       
    54 	{
       
    55 	CTrapCleanup* const trapCleanup=CTrapCleanup::New();
       
    56 	if (trapCleanup==NULL)
       
    57 		{
       
    58 		return KErrNoMemory;
       
    59 		}
       
    60 	TRAPD(error, MainL());
       
    61 	DoTest(error==KErrNone);
       
    62 	delete trapCleanup;
       
    63 	return error;
       
    64 	}