当前位置: 首页>>代码示例>>C++>>正文


C++ CCommandLineArguments::Arg方法代码示例

本文整理汇总了C++中CCommandLineArguments::Arg方法的典型用法代码示例。如果您正苦于以下问题:C++ CCommandLineArguments::Arg方法的具体用法?C++ CCommandLineArguments::Arg怎么用?C++ CCommandLineArguments::Arg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCommandLineArguments的用法示例。


在下文中一共展示了CCommandLineArguments::Arg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MainL

static void MainL(void)
/**
Takes a User Prompt Service policy resource file and dumps it as human readable text to the 
console. The user may also specify the name of an output file on the command line. If so, text
is also written to this file.
*/
	{
	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
		
	CConsoleBase* console = Console::NewL(KAppName, TSize(KDefaultConsWidth, KDefaultConsHeight));
	CleanupStack::PushL(console);
	
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	
	if (args->Count() > 1)
		{		
		CPolicyReader* reader = CPolicyReader::NewLC(fs, args->Arg(1));		
		CPrinter* printer(0);
		if (args->Count() > 2)
			{
			RFile outFile;
			User::LeaveIfError(outFile.Replace(fs, args->Arg(2), EFileShareExclusive | EFileWrite));
			CleanupClosePushL(outFile);
			printer = CPrinter::NewLC(console, outFile);		
			
			CleanupStack::Pop(printer); 
			CleanupStack::PopAndDestroy(&outFile);
			CleanupStack::PushL(printer);
			}
		else
			{
			printer = CPrinter::NewLC(console);	
			}
		__UHEAP_MARK;
		PrintPoliciesL(printer, reader);
		__UHEAP_MARKEND;
		
		if (args->Count() < 3)
			{
			// If no output file is specified then pause after finishing
			// because the console will vanish when it is closed.
			console->Printf(_L("Press any key to continue\r\n"));
			console->Getch();
			}		
		CleanupStack::PopAndDestroy(2, reader); // printer, reader		
		}
	else 
		{
		console->Printf(_L("Usage: dumppolicy.exe policy.rsc <output.txt>\r\n"));
		console->Printf(_L("Press any key to continue\r\n"));
		console->Getch();
		}
	
	CleanupStack::PopAndDestroy(3, &fs); // args, console, fs
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:57,代码来源:dumppolicy.cpp

示例2: MainL

TInt MainL()
	{
	RDebug::Print(_L("appfwk-sysmon-0033: MainL"));

	TInt runCount = 0;
    CCommandLineArguments* args = CCommandLineArguments::NewLC();
    TInt err = RProperty::Define(KTestSysMon, KRestartExeCount, RProperty::EInt);
    RDebug::Printf("Defining P&S key with key %d returns with err %d", err, KRestartExeCount);
    
    runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    CleanupStack::PopAndDestroy(args);

    RDebug::Printf("runCount = %d", runCount);
    switch (runCount)
        {
		case 0:
			{
			RProcess::Rendezvous(KErrNone);
			RSysMonSession sysmon;
			sysmon.OpenL();
			CleanupClosePushL(sysmon);
			
			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_donothing.exe"), _L("33"));
			props->SetMonitored(ETrue);
			props->SetStartupType(EStartProcess);
			props->SetStartMethod(EWaitForStart);
			props->SetNoOfRetries(0);
			props->SetTimeout(0);
			props->SetRecoveryParams(EIgnoreOnFailure, 0);
			
			RProcess slave1;
			slave1.Create(_L("tsysmon_app_donothing.exe"), _L("5000"));
			CleanupClosePushL(slave1);
			TRequestStatus status;
			slave1.Rendezvous(status);
			slave1.Resume();
			User::WaitForRequest(status);

			// Register with SysMon
			sysmon.MonitorL(*props, slave1);
			slave1.Terminate(KErrNone);
			
			CleanupStack::PopAndDestroy(3, &sysmon);
			break;
			}
        default: //Run normally
			{
            RProcess::Rendezvous(KErrNone);
            break;
			}
        }
    
	RDebug::Print(_L("appfwk-sysmon-0033: End MainL"));
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:56,代码来源:tsysmon_app_faileiofcount0.cpp

示例3: mainL

LOCAL_C void mainL()
	{
	CCommandLineArguments* cmdLine = CCommandLineArguments::NewLC();
	CConsoleBase* console = Console::NewL(_L("Siftestintegrationlockfile"),TSize(KConsFullScreen,KConsFullScreen));
	CleanupStack::PushL(console);
	TInt argTotal(cmdLine->Count());
	if (argTotal < 2  || argTotal > 3)
		{
		console->Printf(_L("Incorrect arguments specified: expected 1, received %d"), argTotal - 1);
		User::Leave(KErrArgument);
		}
		
	TPtrC filename(cmdLine->Arg(1));
	_LIT(KDoLockFileParam, " lockfile");
	if (argTotal == 2)
		{
		RBuf params;
		params.CreateL(filename.Length() + KDoLockFileParam().Length());
		params.CleanupClosePushL();
		params.Append(cmdLine->Arg(1));
		params.Append(KDoLockFileParam());
		// Since this executable is used by TEF, we wish to lock the file after the launched process has exited, so we spawn this process again with a different set of parameters
		RProcess newInstance;
		User::LeaveIfError(newInstance.Create(_L("Siftestintegrationlockfile"), params));
		CleanupClosePushL(newInstance);
		newInstance.Resume();
		TRequestStatus status;		
		newInstance.Rendezvous(status);
		User::WaitForRequest(status);
		User::LeaveIfError(status.Int());
		CleanupStack::PopAndDestroy(2, &params); // newInstance
		}
	else
		{
		// This is the execution for locking the file, invoked using the branch above
		console->Printf(_L("Locking file %S for read"), &filename);	
		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
	
		RFile file;
		User::LeaveIfError(file.Open(fs, filename, EFileShareReadersOnly|EFileRead));
		CleanupClosePushL(file);
		// Signal the invoker only here, so that the file will definitely get locked before TEF proceeds to the next step
		RProcess::Rendezvous(KErrNone);		
		
		User::After(10*1000*1000); // Wait for 10 seconds
	
		CleanupStack::PopAndDestroy(2 , &fs); // file
		}
	CleanupStack::PopAndDestroy(2, cmdLine); // console,
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:52,代码来源:siftestintegrationlockfile.cpp

示例4: MainL

TInt MainL()
	{
	RDebug::Print(_L("appfwk-sysmon-0038: MainL"));

	TInt runCount = 0;
    CCommandLineArguments* args = CCommandLineArguments::NewLC();
    runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));
	CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    CleanupStack::PopAndDestroy(args);

    
    switch (runCount)
        {
		case 0:
			{
			RProcess::Rendezvous(KErrNone);
			RSysMonSession sysmon;
			sysmon.OpenL();
			CleanupClosePushL(sysmon);
			TTime time1();

			CStartupProperties* props = CStartupProperties::NewLC(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038"));
			props->SetMonitored(ETrue);
			props->SetStartupType(EStartProcess);
			props->SetStartMethod(EWaitForStart);
			props->SetNoOfRetries(1);
			props->SetTimeout(0);
			props->SetRecoveryParams(EIgnoreOnFailure, 0);

			RProcess slave1;
			slave1.Create(_L("tsysmon_app_failcount2failwait_slave.exe"), _L("APPFWK-SYSMON-0038"));
			CleanupClosePushL(slave1);
			slave1.Resume();

			// Register with SysMon
			sysmon.MonitorL(*props, slave1);
			slave1.Terminate(KErrNone);

			CleanupStack::PopAndDestroy(3, &sysmon);
			break;
			}
		default: //Run normally
			{
            RProcess::Rendezvous(KErrNone);
            break;
			}
        }
	RDebug::Print(_L("appfwk-sysmon-0038: End MainL"));
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:50,代码来源:tsysmon_app_failcount2failwait.cpp

示例5: HandleCommandL

//             Called by the UI framework when a command has been issued.
//             In this example, a command can originate through a 
//             hot-key press or by selection of a menu item.
//             The command Ids are defined in the .hrh file
//             and are 'connected' to the hot-key and menu item in the
//             resource file.
//             Note that the EEikCmdExit is defined by the UI
//             framework and is pulled in by including eikon.hrh
//
void CExampleAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		      // Just issue simple info messages to show that
		      // the menu items have been selected
	case EExampleItem0:
		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM0);
		break;

	
	case EExampleItem1:
		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM1);
		break;
	
	case EExampleItem2:
		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM2);
		break;
               // Exit the application. The call is
		       // implemented by the UI framework.

	case EEikCmdExit: 
		TInt timerDuration(KDefaultTimeout);
	    CCommandLineArguments* cmdLine = CCommandLineArguments::NewL();
		TInt argTotal=cmdLine->Count();
		for (TInt loop=1 ; loop < argTotal ; ++loop)
			{
			TPtrC arg(cmdLine->Arg(loop));
			if (arg==KSetShutDownTimeOption && loop++ < (argTotal-1))
				{
				TLex timeoutLex(cmdLine->Arg(loop));
				timeoutLex.Val(timerDuration);
				}
			}
		delete cmdLine;
		if(timerDuration > 0)
			{
			RTimer timer;
			TRequestStatus timerStatus;
			timer.CreateLocal();
			timer.After(timerStatus, timerDuration);
			User::WaitForRequest(timerStatus);
			timer.Close();
			}
		Exit();
		break;
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:57,代码来源:HelloWorld_AppUi.cpp

示例6: MainL

LOCAL_C void MainL()
/**
 * Main implementation
 */
	{
	CActiveScheduler* sched=NULL;
	sched=new(ELeave) CActiveScheduler;
	CActiveScheduler::Install(sched);
	CTeIpUpsSuite* server = NULL;
		
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	TPtrC exeName = args->Arg(0);
	TParse fullName;
	fullName.Set(exeName, NULL, NULL);
	CleanupStack::PopAndDestroy(args);
	
	// Create the CTestServer derived server
	TRAPD(err,server = CTeIpUpsSuite::NewL(fullName.Name()));
	if(!err)
		{
		// Sync with the client and enter the active scheduler
		RProcess::Rendezvous(KErrNone);
		sched->Start();
		}
	delete server;
	delete sched;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:27,代码来源:te_ipups_server.cpp

示例7: DoStartL

LOCAL_C void DoStartL()
	{
	// Create active scheduler (to run active objects)
	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
	CFed* fed = CFed::NewL(*console, fs);
	CleanupStack::PushL(fed);
	CDesC16ArrayFlat* argsBuf = new(ELeave) CDesC16ArrayFlat(4);
	CleanupStack::PushL(argsBuf);
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	for (TInt i = 1; i < args->Count(); i++) // Start from 1 as arg zero is the exe name
		{
		// No attempt to be clever with arguments - this code is only used when building a raw non-fshell version - mainfshell has the nicer equivalent
		TPtrC arg = args->Arg(i);
		argsBuf->AppendL(arg);
		}
	CleanupStack::PopAndDestroy(args);
	CleanupStack::Pop(argsBuf);
	gFed = fed;
	fed->StartL(argsBuf);
	CActiveScheduler::Start();

	// Delete active scheduler
	CleanupStack::PopAndDestroy(3, scheduler); // fed, fs, scheduler
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:30,代码来源:main.cpp

示例8: BaseConstructL

// -----------------------------------------------------------------------------
// Cosmo4AppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void COsmo4AppUi::ConstructL()
{
    // Initialise app UI with standard value.
    BaseConstructL(CAknAppUi::EAknEnableSkin);

    /*Create display*/
    iAppView = COsmo4AppView::NewL( ClientRect() );
	AddToStackL(iAppView);

	/*create playlist*/
#ifndef GPAC_GUI_ONLY
	iPlaylist = CPlaylist::NewL( ClientRect(), iAppView->GetUser() );

	iPlaylist->MakeVisible(EFalse);
#endif
	
	iAppView->MakeVisible(ETrue);
	view_mode = 0;

	m_title = NULL;

	//StatusPane ()->SwitchLayoutL ( R_AVKON_STATUS_PANE_LAYOUT_SMALL );

	nb_keys = 0;
	CaptureKeys(1);



	CCommandLineArguments *args = CCommandLineArguments::NewL();
#ifndef GPAC_GUI_ONLY
	if (args->Count() > 1) {
		TPtrC url = args->Arg(1);
#if defined(_UNICODE)
		char szURL[1024];
		u16 szURLUTF16[1024];
		size_t len;
		len = url.Size();
		memcpy(szURLUTF16, url.Ptr(), sizeof(u8)*len);
		szURLUTF16[len/2] = 0;
		const u16 *sptr = szURLUTF16;
		len = gf_utf8_wcstombs(szURL, 512, &sptr);
		if (len != (size_t) -1) {
			szURL[len] = 0;
			iAppView->Connect((const char *)szURL);
		}
#else
		iAppView->Connect((const char *)url.Ptr());
#endif
	}
#endif
	delete args;
}
开发者ID:bigbensk,项目名称:gpac,代码行数:57,代码来源:osmo4_ui.cpp

示例9: InternalizeL

void CCellTowerDataSimulation::InternalizeL() {
	RFs aSession;
	RFile aFile;
	TFileName aFileName;
	TInt aFileSize;

	if(aSession.Connect() == KErrNone) {
		CleanupClosePushL(aSession);

#ifndef __SERIES60_3X__
		aFileName = TFileName(_L("CellTowerSimData.txt"));
		CompleteWithAppPath(aFileName);
#else
		if(aSession.PrivatePath(aFileName) == KErrNone) {
#ifndef __WINSCW__
			aFileName.Insert(0, _L(":"));
			CCommandLineArguments* pArguments;
			TFileName drive;
			pArguments = CCommandLineArguments::NewL();
			if (pArguments->Count() > 0) {
				drive.Append(pArguments->Arg(0)[0]);
				aFileName.Insert(0, drive);
				delete pArguments;
			}
#endif

			aFileName.Append(_L("CellTowerSimData.txt"));

#ifdef __WINSCW__
			aFileName.Insert(0, _L("z:"));
#endif
		}
#endif

		if(aFile.Open(aSession, aFileName, EFileStreamText|EFileRead) == KErrNone) {
			CleanupClosePushL(aFile);
			aFile.Size(aFileSize);

			// Creat buffer & read file
			iCellBuffer = HBufC8::NewL(aFileSize);
			TPtr8 pCellBuffer(iCellBuffer->Des());
			aFile.Read(pCellBuffer);
			aFile.Close();
			
			CleanupStack::PopAndDestroy(&aFile);
		}
		
		CleanupStack::PopAndDestroy(&aSession);
	}
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:50,代码来源:CellTowerDataSimulation.cpp

示例10: StartTestL

void CSdlAppUi::StartTestL(TInt aCmd)
{

	//TInt flags = CSDL::EDrawModeGdi | CSDL::EEnableFocusStop
	//		| CSDL::EMainThread;// | CSDL::EAutoOrientation;

	TInt flags = 0;

	//flags |= CSDL::EDrawModeDSB | CSDL::EDrawModeDSBDoubleBuffer;
	flags |= CSDL::EDrawModeGdi;
	// Don't draw when in background.
	//flags |= CSDL::EEnableFocusStop;
	flags |= CSDL::EAutoOrientation;
	// This should be on by default anyway
	flags |= CSDL::EMainThread;

	//Create CommandLine Arguments and read it.
	CDesC8ArrayFlat *arr = new (ELeave) CDesC8ArrayFlat(1);
	CleanupStack::PushL(arr);

	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	// The real args we are interested in start at the 2nd arg
	for (TInt i = 1; i < args->Count(); i++)
	{
		TBuf8<256> arg;
		arg.Copy(args->Arg(i));

		arr->AppendL(arg);
		//TPtrC argumentPrt(args->Arg(i));
		//console->Printf(_L("Arg %d == %S\n"), i, &argumentPrt);
	}

	iSdl = CSDL::NewL(flags);

	iSdl->SetContainerWindowL(iSDLWin->GetWindow(), iEikonEnv->WsSession(),
			*iEikonEnv->ScreenDevice());
	iSdl->CallMainL(iWait->iStatus, *arr, flags, 0x14000);
	iWait->Start();

	arr->Reset();
	CleanupStack::PopAndDestroy(2); // command line and arr
}
开发者ID:Anugrahaa,项目名称:anagrammatic,代码行数:42,代码来源:pygame_app.cpp

示例11: DoStartL

LOCAL_C void DoStartL() 
	{
	CCommandLineArguments* args = CCommandLineArguments::NewLC();
	TInt i = args->Count();

	if ( args->Count() == 2 )
		{
		TLex tlex(args->Arg(1));
		TInt argVal = 0;
		if ( tlex.Val(argVal) == KErrNone )
			{
			// 
			if(argVal == 1)
				{
				RFeatureControl control;
				TInt err = control.Connect();

				TBitFlags32 flags( 0 );
				flags.Set( EFeatureSupported);
				flags.Set( EFeatureModifiable );

				// Adding features
				TFeatureEntry entry1( KNewUid1, flags, KDefaultData1 );
				err = control.AddFeature(entry1);

				control.Close();
				}
			else if( argVal == 2)
				{
				RFeatureControl control;
				TInt err = control.Connect();

				err = control.SWIEnd();

				control.Close();
				}
			}
		}
	CleanupStack::PopAndDestroy(); //args
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:40,代码来源:helping_exe.cpp

示例12: ConstructL

void CAppView::ConstructL()
{
	DebugMarkStart();
	LOGD("HELLOTE\n");

#if 0
	CCommandLineArguments* cla = CCommandLineArguments::NewLC();
	LOGD("CLA count: %i\n", cla->Count());
	for(int i=0; i<cla->Count(); i++) {
		HBufC8* buf = CreateHBufC8FromDesC16LC(cla->Arg(i));
		LOGD("%i \"%S\"\n", i, buf);
		CleanupStack::PopAndDestroy(buf);
	}
	CleanupStack::PopAndDestroy(cla);
#endif	//0

	CreateWindowL();  // Create a window for this application view
	// Set the window size
	SetRect(CCoeEnv::Static()->ScreenDevice()->SizeInPixels());
	iEngine = CDirScrAccEng::NewL(iEikonEnv->WsSession(),
		*(CCoeEnv::Static()->ScreenDevice()), Window());
	LOGD("AVC1\n");

	EnableDragEvents();

	iEventBuffer.SetLengthL(EVENT_BUFFER_SIZE);

	ActivateL();  // Activate the window, which makes it ready to be drawn
	LOGD("AVC3\n");

	iWaitTimer = new (ELeave) CWaitTimer(*this);
	iWaitTimer->ConstructL();

	iDelayTimer = new (ELeave) CDelayTimer(*this);
	iDelayTimer->ConstructL();

	iIdle = CIdle::NewL(MyPrioIdle);
	iIdle->Start(TCallBack(StartStuff, this));
}
开发者ID:GregorGullwi,项目名称:MoSync,代码行数:39,代码来源:AppView.cpp

示例13: StartPSYCRTesterL

void StartPSYCRTesterL() 
	{

	// Read the Process Arguments
	TInt psyIDValue;

    // PSY Tester sends the UID of the PSY as an argument
	CCommandLineArguments *args = CCommandLineArguments::NewL();
	CleanupStack::PushL(args);
	if(args->Count() <= 1)
	{
			User::Leave(KErrArgument);
	}
	TPtrC ptr = args->Arg(1);
	
	TLex lex(ptr.Ptr());
	TInt err = lex.Val(psyIDValue);

	if(KErrNone == err)
	{
		
		CPosPSYCRTestHandler* psyCRTestHandler = CPosPSYCRTestHandler::NewL();
		CleanupStack::PushL(psyCRTestHandler);

		TUid psyID;
		psyID.iUid = psyIDValue;
	
	    // Start the test	
		psyCRTestHandler->StartPSYCRTesterL(psyID);
		
		CleanupStack::PopAndDestroy(psyCRTestHandler);
	}
	
	CleanupStack::PopAndDestroy(args);
		
	RProcess::Rendezvous(KErrNone);

	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:38,代码来源:epos_psycrtester_main.cpp

示例14: MainL

/**
* Main function. Process command line arguments and import bookmark data.
*/
LOCAL_D void MainL()
    {
    TBuf<KFormatBufLen> buf;
    TInt num;
    CCommandLineArguments* args = CCommandLineArguments::NewLC();
    if( args->Count() != 2 )
        {
        // Expecting command line 'Appname outfile'.
        User::Leave( KErrArgument );
        }
    RFs fs;
    User::LeaveIfError( fs.Connect() );
    CleanupClosePushL<RFs>( fs );
    RUnicodeFile file;
    User::LeaveIfError( file.ReplaceL
        ( fs, args->Arg( 1 ), EFileWrite | EFileShareExclusive ) );
    CleanupClosePushL<RUnicodeFile>( file );
    RFavouritesSession sess;
    User::LeaveIfError( sess.Connect() );
    CleanupClosePushL<RFavouritesSession>( sess );
    RFavouritesDb db;
    User::LeaveIfError( db.Open( sess, KBrowserBookmarks ) );
    CleanupClosePushL<RFavouritesDb>( db );
    User::LeaveIfError( db.Begin( /*aWrite=*/EFalse ) );
    db.CleanupRollbackPushL();

    CFavouritesItemList* items = new (ELeave) CFavouritesItemList();
    CleanupStack::PushL( items );
    const CFavouritesItem* item;
    User::LeaveIfError( db.GetAll( *items ) );
    buf.Format( _L("%d entries\r\n"), items->Count() );
    User::LeaveIfError( file.Write( buf ) );
    for ( TInt i = 0; i < items->Count(); i++ )
        {
        User::LeaveIfError( file.Write( _L("\r\n") ) );
        item = items->At( i );
        // Uid.
        num = item->Uid();
        buf.Format( _L("Uid=(%d)"), num );
        User::LeaveIfError( file.Write( buf ) );
        // Fixed Uid info.
        if ( num == KFavouritesRootUid )
            {
            User::LeaveIfError( file.Write( _L(" (root folder)\r\n") ) );
            }
        else if ( num == KFavouritesHomepageUid )
            {
            User::LeaveIfError( file.Write( _L(" (homepage)\r\n") ) );
            }
        else if ( num == KFavouritesLastVisitedUid )
            {
            User::LeaveIfError( file.Write( _L(" (last visited)\r\n") ) );
            }
        else
            {
            User::LeaveIfError( file.Write( _L("\r\n") ) );
            }
        // Type.
        if ( item->Type() == CFavouritesItem::EFolder )
            {
            User::LeaveIfError( file.Write( _L("Type=Folder\r\n") ) );
            }
        else if ( item->Type() == CFavouritesItem::EItem )
            {
            User::LeaveIfError( file.Write( _L("Type=Item\r\n") ) );
            }
        else
            {
            User::LeaveIfError( file.Write( _L("Type=HUH???\r\n") ) );
            }
        TPtrC ptr;
        // Name
        ptr.Set( item->Name() );
        buf.Format( _L("Name=<%S>\r\n"), &ptr );
        User::LeaveIfError( file.Write( buf ) );
        // Parent.
        buf.Format( _L("ParentFolder=(%d)\r\n"), item->ParentFolder() );
        User::LeaveIfError( file.Write( buf ) );
        // Url.
        ptr.Set( item->Url() );
        buf.Format( _L("Url=<%S>\r\n"), &ptr );
        User::LeaveIfError( file.Write( buf ) );
        // Access Point.
        if ( item->WapAp().IsNull() )
            {
            User::LeaveIfError( file.Write( _L("WapAp=Null\r\n") ) );
            }
        else if ( item->WapAp().IsDefault() )
            {
            User::LeaveIfError( file.Write( _L("WapAp=Default\r\n") ) );
            }
        else
            {
            buf.Format( _L("WapAp=(%d)\r\n"), item->WapAp().ApId() );
            User::LeaveIfError( file.Write( buf ) );
            }
        // UserName.
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:BookmarkDumpMain.cpp

示例15: MainL

LOCAL_C TInt MainL()
{
    RProcess delayer;
    delayer.Create(_L("tsysmon_app_delayshutdown.exe"),KNullDesC);
    delayer.Resume();
    delayer.Close();

    TInt runCount = 0;
    CCommandLineArguments* args = CCommandLineArguments::NewLC();
    runCount = CSysMonTestHelper::ReadRunCountL(args->Arg(0));

    CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    CleanupStack::PopAndDestroy(args);

    TBool keepRunning = EFalse;

    CSysMonTestHelper* helper = NULL;

    switch (runCount)
    {
    case 0:
    {
        RProcess::Rendezvous(KErrNone);
        helper = CSysMonTestHelper::NewLC();

        RSysMonSession sysmon;
        sysmon.OpenL();
        CleanupClosePushL(sysmon);

        TBuf<255> args;
        TBuf<255> testId;
        helper->GetTestId(testId);
        RDebug::Print(testId);
        args.Append(testId);
        args.Append(_L(" "));
        args.Append(_L("5000"));

        CStartupProperties* props = CStartupProperties::NewLC(KFilenameDeregTimeout, args);
        props->SetMonitored(ETrue);
        props->SetStartupType(EStartProcess);
        props->SetStartMethod(EWaitForStart);
        props->SetNoOfRetries(0);
        props->SetTimeout(0);
        props->SetRecoveryParams(ERestartOSWithMode, 1);

        CStartupProperties* props2 = CStartupProperties::NewLC(_L("tsysmon_app_donothing.exe"), KNullDesC);
        props2->SetMonitored(ETrue);
        props2->SetStartupType(EStartProcess);
        props2->SetStartMethod(EWaitForStart);
        props2->SetNoOfRetries(1);
        props2->SetTimeout(0);
        props2->SetRecoveryParams(ERestartOS, 0);

        RProcess slave1;
        slave1.Create(KFilenameDeregTimeout, args);
        CleanupClosePushL(slave1);
        slave1.Resume();

        RProcess slave2;
        slave2.Create(_L("tsysmon_app_donothing.exe"), KNullDesC);
        CleanupClosePushL(slave2);
        slave2.Resume();

        // Register with SysMon
        TInt err = 0;
        TRAP(err, sysmon.MonitorL(*props, slave1));
        TRAP(err, sysmon.MonitorL(*props2, slave2));
        slave1.Terminate(KErrNone);
        slave2.Terminate(KErrNone);

        CleanupStack::PopAndDestroy(5, helper);
        break;
    }
    case 1:
    {
        RProcess::Rendezvous(KErrNone);
        keepRunning = ETrue;
        helper = CSysMonTestHelper::NewLC();
        TInt startupMode;
        HAL::Get(HALData::EPersistStartupModeKernel, startupMode);
        helper->WriteResultL(startupMode);
        CleanupStack::PopAndDestroy(helper);
        break;
    }
    default: //Run normally
    {
        RProcess::Rendezvous(KErrNone);
        keepRunning = ETrue;
        break;
    }
    }

    CSysMonTestHelper::IncrementRunCountL(args->Arg(0));
    CleanupStack::PopAndDestroy(args);

    while (keepRunning)
    {
        User::After(5000000); // 5 seconds
    }
    return 0;
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:tsysmon_app_restartfailwithmode1.cpp


注:本文中的CCommandLineArguments::Arg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。