• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TFileText类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TFileText的典型用法代码示例。如果您正苦于以下问题:C++ TFileText类的具体用法?C++ TFileText怎么用?C++ TFileText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: ConstructL

void CSettings::ConstructL()
{
    RFs fs;
    RFile file;
    TFileText text;
    TLex lex;
    TBuf<256> buf;
    User::LeaveIfError(fs.Connect());
    if(file.Open(fs,_L("C:\\System\\Apps\\vcall\\times"),EFileRead) != KErrNone)
    {
        User::Panic(_L("Config file not open"),KErrNotFound);
    }
    text.Set(file);
    while(text.Read(buf) == KErrNone)
    {
        lex.Assign(buf);
        TInt val;
        lex.Val(val);//TODO: error handling
        iTimes.Append(val);
    }
    file.Close();
    //iTimes.SortSigned();//TODO: fix sort
    iTimer = CVTimer::NewL();
    iTimer->setTimes(iTimes);
}
开发者ID:Seikareikou,项目名称:symbian,代码行数:25,代码来源:settings.cpp


示例2:

void CTap2MenuAppUi::ReadExceptions()
	{
	TInt err=KErrNone;
	iExceptions.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KExceptionsPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		TLex conv;
		TUint32 IntVal;
		RFile filesave;
		TBuf<255> t;
		TFileText ft;
		filesave.Open(CEikonEnv::Static()->FsSession(), KExceptionsPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			conv.Assign(val);
			conv.Val(IntVal,EHex);
			iExceptions.AppendL(TUid::Uid(IntVal));
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KExceptionsPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:32,代码来源:Tap2MenuAppUi.cpp


示例3: RDEBUG

// -----------------------------------------------------------------------------
// CStartupAdaptationStubModel::ReadConfigFileL
//
// -----------------------------------------------------------------------------
//
void CStartupAdaptationStubModel::ReadConfigFileL()
    {
    RDEBUG( _L( "CStartupAdaptationStubModel::ReadConfigFileL." ) );

    RFs fs;
    User::LeaveIfError( fs.Connect() );
    CleanupClosePushL( fs );

    RFile file;
    User::LeaveIfError( file.Open( fs, KConfigFile, EFileShareReadersOnly ) );
    CleanupClosePushL( file );

    TFileText reader;
    reader.Set( file );

    TBuf<256> buf;
    TLex lex( buf );

    for ( TInt i = 0; i < KNumResponseLists; i++ )
        {
        User::LeaveIfError( reader.Read( buf ) );

        RDEBUG_1( _L( "CStartupAdaptationStubModel: Config line: %S." ), &buf );

        lex.Assign( buf );
        ReadStructuredListL(
            iResponses[ i ].iParts, lex, *( iResponses[ i ].iList ) );
        }

    CleanupStack::PopAndDestroy( 2 ); // file, fs

    RDEBUG( _L( "CStartupAdaptationStubModel::ReadConfigFileL finished." ) );
    }
开发者ID:cdaffara,项目名称:symbian-oss_adapt,代码行数:38,代码来源:StartupAdaptationStubModel.cpp


示例4: new

void CHttpTypes::ReadHttpTypesFileL(const TDesC& aFileName)
{
	RFs fs;

#if EPOC_SDK >= 0x06000000
	User::LeaveIfError(fs.Connect());
	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);

	HBufC *config = NULL;
	// Need to TRAP leaves, because must close the fs (right).
	// Thus, no point in using the CleanupStack for config either.
	//
	TRAPD(err, config = UnicodeLoad::LoadL(fs, aFileName));
	if (err == KErrNone && config != NULL)
		{
		TLineBuffer buffer(config->Des());
		while (!buffer.EOB())
			{
			TPtrC line = buffer.ReadLine();
			if (line.Length() > 0)
				{
				TRAP(err, ParseTypeLineL(line));
				if (err != KErrNone)
					break;
				}
			}
		}
	delete config;
	User::LeaveIfError(err);

#else
	RFile cfg;
	TFileText cfgtxt;
	TBuf<256> buffer;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Open(fs,aFileName,EFileStreamText));

	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);
	
	cfgtxt.Set(cfg);
	User::LeaveIfError(cfgtxt.Seek(ESeekStart));
	
	cfgtxt.Read(buffer);
	while (buffer.Length() > 0)
	{
		ParseTypeLineL(buffer);
		cfgtxt.Read(buffer);
	}
	
	cfg.Close();
#endif
	iHttpTypesArray->Sort();

	fs.Close();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:56,代码来源:ws_eng.cpp


示例5: LeaveIfError

 /*
  * Save Form data, function to be executed when save option is selected. 
  * Creates the second form which allows for selecting the category.
  */
 TBool CYPagesForm1::SaveFormDataL()
{  
    CAknPopupFieldText* popupFieldText = static_cast <CAknPopupFieldText*> (ControlOrNull(EYPagesPopup));
 	if (popupFieldText) {		
		TInt categoryIndex = popupFieldText->CurrentValueIndex();
		TBuf <30> KMyTextFile;
		KMyTextFile.Format(_L("D:\\YPages\\%d%d.txt"), iColor, categoryIndex);
		
		RFs fileServer;
 	    User :: LeaveIfError (fileServer.Connect());
 	    RFile file;
 	    User::LeaveIfError(file.Open(fileServer, KMyTextFile, EFileRead|EFileStreamText));
 	    CleanupClosePushL(file);
 	    
 	    TFileText fileText;
 	    fileText.Set(file);
 	    
 	    TBuf<100> buffer;
 	    buffer = _L("");

 	    RBuf rBuf;
 	    rBuf.Create(buffer);
 	    rBuf.CleanupClosePushL();
 	    
 	  
 	    TInt err = KErrNone;
 	    while(err != KErrEof) {
 			err = fileText.Read(buffer);
 	    
 			if ((err != KErrNone) && (err != KErrEof)) {
 				User :: Leave(err);
 			}
 			if (KErrNone == err) {
 				rBuf.ReAllocL(rBuf.Length() + buffer.Length()+2);
 				rBuf.Append(buffer);
 				rBuf.Append(_L("\n"));
 			}
 	    }
 	    CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(rBuf);
 	    dlg->PrepareLC(R_ABOUT_HEADING_PANE);
   	    dlg->SetHeaderTextL(_L(""));  
   	    dlg->RunLD();
 	    		     
 	    CleanupStack::PopAndDestroy(&rBuf);
 	    CleanupStack::PopAndDestroy(&file);
 	    
 	    fileServer.Close();

 	
 	}

        

 	return ETrue;
 }
开发者ID:pulkit110,项目名称:Yellow-Pages-Symbian,代码行数:59,代码来源:YPagesForm1.cpp


示例6: LocationRequestThread

/**
 * This is the main function for threads that connects and
 * disconnect from MLFW
 *
 * Function returns 0 if running of the test did not leave.
 *Otherwise the leave code is returned.
 **/
LOCAL_C TInt LocationRequestThread(TAny* aData)
{
    // Create cleanupstack for this thread
    CTrapCleanup* cleanup = CTrapCleanup::New();

    // No parameters to read, just start main function.

    HBufC* buf = HBufC::NewL(1024);

    TPtr ptr = buf->Des();

    // Run the actual test, and trap possible leave
    TRAPD(leave, LocationRequestThreadMainPartL(ptr));

    // Open connection to file server
    RFs fs;
    User::LeaveIfError(fs.Connect());

    TInt index = *((TInt*) aData);

    TBuf<30> errorFile;
    _LIT(KInfThread, "c:\\logs\\thread%derrinfo.txt");
    errorFile.Format(KInfThread, index);

    // Open log file
    RFile file;

    TInt err = file.Replace(fs,errorFile,EFileStreamText|EFileWrite);

    if (err != KErrNone)
        {
        User::Leave(err);
        }

    _LIT(KErrLeave, "*** This thread (thread %d) leave code: %d\r\n");
    ptr.AppendFormat(KErrLeave, index, leave);

    TFileText fileText;
    fileText.Set(file);

    fileText.Write(ptr);

    // Close log file
    file.Close();
    fs.Close();

    // Delete cleanup stack
    delete cleanup;

    // Exit this thread with leave code (KErrNone in successful case)
    User::Exit(leave);

    return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:61,代码来源:ctlbsclientpostp208.cpp


示例7: ShowL

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
    {
    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
    CDesCArray* itemArray = ( CDesCArray* ) itemList;

    itemArray->AppendL( aString );

    iListbox->HandleItemAdditionL();
    iListbox->SetCurrentItemIndex( iCount );
    iCount++;
    if ( aLast )
        {
        if (aFileOutput)
            {
            RFile file;
            RFs& fs = CEikonEnv::Static()->FsSession();
            TFileName fileName =_L("Layout_");

            TRect screenRect;
            AknLayoutUtils::LayoutMetricsRect(
                AknLayoutUtils::EApplicationWindow,
                screenRect );

            // Add screen dimensions
            TInt height = screenRect.Height();
            TInt width = screenRect.Width();
            fileName.AppendNum(height);
            fileName.Append('_');
            fileName.AppendNum(width);

            fileName.Append(_L(".txt"));

            TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            if (err==KErrNotFound) // file does not exist - create it
                err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            else
                file.SetSize(0); //sweep the file
            TFileText textFile;
            textFile.Set(file);
            err = textFile.Seek(ESeekStart);
            if (err) User::InfoPrint(_L("File corrupted"));

            // Finally loop through all the entries:
            TInt idx = 0;
            for(;idx!=itemList->MdcaCount();idx++)
                {
                err = textFile.Write(itemList->MdcaPoint(idx));
                if (err) User::InfoPrint(_L("File corrupted"));
                }
            file.Close();
            }
        DrawNow();
        }
    }
开发者ID:mpvader,项目名称:qt,代码行数:58,代码来源:pm_mapperview.cpp


示例8: TRAPD

void CWebServerEnv::ReadConfigFileL(const TDesC& aConfigFileName)
//Function which reads and parse the confing file
{

	RFs fs;
#if EPOC_SDK >= 0x06000000
	User::LeaveIfError(fs.Connect());
	HBufC *config = NULL;
	// Need to TRAP leaves, because must close the fs (right).
	// Thus, no point in using the CleanupStack for config either.
	//
	TRAPD(err, config = UnicodeLoad::LoadL(fs, aConfigFileName));
	if (err == KErrNone && config != NULL)
		{
		TLineBuffer buffer(config->Des());
		while (!buffer.EOB())
			{
			TPtrC line = buffer.ReadLine();
			if (line.Length() > 0)
				{
				TRAP(err, ParseConfigLineL(fs, line));
				if (err != KErrNone)
					break;
				}
			}
		}
	delete config;
	fs.Close();
	User::LeaveIfError(err);
#else
	RFile cfg;
	TFileText cfgtxt;
	TBuf<256> buffer;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Open(fs,aConfigFileName,EFileStreamText));
	
	cfgtxt.Set(cfg);
	User::LeaveIfError(cfgtxt.Seek(ESeekStart));
	cfgtxt.Read(buffer);
	while (buffer.Length() > 0)
	{
		ParseConfigLineL(fs,buffer);
		cfgtxt.Read(buffer);
	}
	
	cfg.Close();

	fs.Close();
#endif
	CheckAndSetDefaultL();

}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:53,代码来源:ws_eng.cpp


示例9: SaveL

TInt CSpecialLog::SaveL(void)
{
	// Open file.
	TFileName filename;
	filename.Copy(KSpecialLogPath);
	filename.Append(KSpecialLogFile);
	RFile file;
	TInt result = file.Replace(* iFs, filename, EFileWrite);
	if (KErrNone != result)
	{
		return result;
	}

	// Write file
	TFileText fileText;
	fileText.Set(file);
	HBufC* buffer = HBufC::NewLC(KSpecialLogLineBufferSize);
	TPtr line = buffer->Des();

	line.Copy(KSpecialLogSection);					// Write section header.
	fileText.Write(line);

	for (TInt i = 0; i < iLogSpecial.Count(); i ++)	// Write all special log entries.
	{
		const RLogSpecial & entry = iLogSpecial[i];
		// Write key (text if defined, otherwise index)
		if (i < KNumSpecialLogKeys)
			line.Copy((const TUint16 *) KSpecialLogKeyText[i]);	// TODO: Fix the cast.
		else
			line.Num(i);

		line.Append(_L("="));
		// Write value.
		if (ESpecialLogInt == entry.iType)
			line.AppendNum(entry.iInt);
		else
			line.Append(* entry.iText);

		result = fileText.Write(line);
		if (result != KErrNone)
			break;
	}
	CleanupStack::PopAndDestroy(buffer);
	file.Close();

	if (KErrEof == result) result = KErrNone;

	iState = ESaved;

	// Bubble result of TFileText::Write().
	return result;
}
开发者ID:yindian,项目名称:fontrouter,代码行数:52,代码来源:DebugHelper.cpp


示例10: CallTestsQL

GLDEF_C void CallTestsQL(TInt aDrive)
//
// Call tests for remote drive
//
	{

	Test0(testq);
	
	testq.Printf(_L("This may take some time.  Please be patient...\n"));
	
	testq.Next(_L("Test remote drive with multiple sessions"));
	MultipleSessions(aDrive,testq);

	const TInt numberOfTests=10;
	
	TPtrC record[numberOfTests];
	
	TInt i=0;
	for (;i<numberOfTests;i++)
		{
		if (i%2)
			record[i].Set(_L("Hubble_Bubble"));
		else
			record[i].Set(_L("Toil_and_Trouble"));
		}
	
	testq.Next(_L("Create a file 'TEXTFILE.TXT' on the remote drive"));
	RFile f;
	TInt r=f.Replace(TheFs,_L("TEXTFILE.TXT"),0);
	testq(r==KErrNone);
	TFileText textFile;
	textFile.Set(f);
	
	testq.Next(_L("Write to 'TEXTFILE.TXT'"));
	
	for (i=0;i<numberOfTests;i++)
		{
		r=textFile.Write(record[i]);
		testq(r==KErrNone);
		testq.Printf(_L("Write %d completed OK\n"),i+1);
		}
	
	f.Close();

	RFile file1;
	r=file1.Open(TheFs,_L("Q:\\TEST\\T_FSRV.CPP"),EFileRead|EFileShareReadersOnly);
	testq(r==KErrNone);
	file1.Close();	

	}
开发者ID:SymbianSource,项目名称:oss.FCL.interim.QEMU,代码行数:50,代码来源:svphost.cpp


示例11: TestAddressStringTokenizers

void CT_AddressStringTokenizerStep::TestAddressStringTokenizers(CTulAddressStringTokenizer* aAddressStringTokenizer, TFileText& aReader, TDes& aText)
	{
    TBuf<KReadBufSize> fileBuffer;

    // Get count of found items.
    TInt count(aAddressStringTokenizer->ItemCount());
	TEST(count > 0);
	TPtrC result;

    // SFoundItem instance
    CTulAddressStringTokenizer::SFoundItem item;

    TBool found = aAddressStringTokenizer->Item(item);
    TEST(found);
    for(TInt i = 0; i < count; i++)
		{
        result.Set(aText.Mid(item.iStartPos, item.iLength));
		aReader.Read(fileBuffer);

		//Comparing parsed result to what read buffer reads from the file.
		TEST(!fileBuffer.Compare(result) );
		if (fileBuffer.Compare(result))
			{
			INFO_PRINTF2(_L("Buffer : %S"), &fileBuffer);
			INFO_PRINTF2(_L("Result : %S"), &result);
			}
        aAddressStringTokenizer->NextItem(item);
        }
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:29,代码来源:t_addressstringtokenizer.cpp


示例12: GetConfigFileNameL

void CCryptoPluginsLoader::LoadPluginsL()
{
    HBufC *configFileBuf = GetConfigFileNameL();
    CleanupStack::PushL(configFileBuf);
    TPtr configFile(configFileBuf->Des());

    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    RFile file;
    User::LeaveIfError(file.Open(fs, configFile, KEntryAttNormal));
    CleanupClosePushL(file);

    TFileText ft;
    ft.Set(file);
    TFileName line;

    User::LeaveIfError(ft.Read(line));

    //Load all the plugins
    do
    {
        TFileName filename;
        filename.Append(KPluginDir);
        filename.Append(line);

        //Load...
        RLibrary plugin;
        TInt err=plugin.Load(filename);
        if (err==KErrNone)
        {
            CleanupClosePushL(plugin);
            iPluginDllList.AppendL(plugin);
            CleanupStack::Pop(&plugin);
            iPluginNames.AppendL(line);
        }
    }
    while(ft.Read(line) == KErrNone);


    CleanupStack::PopAndDestroy(&file);
    CleanupStack::PopAndDestroy(&fs);
    CleanupStack::PopAndDestroy(configFileBuf);

    BuildPluginCharacteristicsL();
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:47,代码来源:cryptopluginsloader.cpp


示例13: GetAppPath

void CDesktopHotKeyAppUi::About()
	{
	TFileName filename;
	GetAppPath(filename);
	HBufC* textResource = StringLoader::LoadLC(R_ABOUT_FILE);
	filename.Append(textResource->Des());
	CleanupStack::PopAndDestroy(textResource);

	RFile file;
	TInt nErr = file.Open(CEikonEnv::Static()->FsSession(), filename, EFileRead
			| EFileShareAny);
	if (nErr != KErrNone)
		return;

	TFileText fileText;
	fileText.Set(file);
	TBuf<128> linePtr;
	HBufC* iText = NULL;

	while (fileText.Read(linePtr) == KErrNone)
		{
		if (iText!=NULL)
			{
			iText = iText->ReAllocL(iText->Length() + linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		else
			{
			iText = HBufC::NewL(linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		iText->Des().Append(CEditableText::ELineBreak);
		}
	file.Close();

	ShowModalAboutDlgL(R_ABOUT_DIALOG_TITLE,iText->Des());
	
	
	delete iText;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:40,代码来源:DesktopHotKeyAppUi.cpp


示例14: GetAppPath

TBool CHelpContainer::ReadTextL()
	{
	TFileName filename;
	GetAppPath(filename);
	HBufC* textResource = StringLoader::LoadLC(R_HELP_FILE);
	filename.Append(textResource->Des());
	CleanupStack::PopAndDestroy(textResource);

	RFile file;
	TInt nErr = file.Open(CEikonEnv::Static()->FsSession(), filename, EFileRead
			| EFileShareAny);
	if (nErr)
		{
		return EFalse;
		}

	TFileText fileText;
	fileText.Set(file);
	TBuf<128> linePtr;

	while (fileText.Read(linePtr) == KErrNone)
		{
		if (iText)
			{
			iText = iText->ReAllocL(iText->Length() + linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		else
			{
			iText = HBufC::NewL(linePtr.Length() + 2);
			iText->Des().Append(linePtr);
			}
		iText->Des().Append(CEditableText::ELineBreak);
		}
	file.Close();

	return ETrue;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:38,代码来源:HelpContainer.cpp


示例15: conv

void CTap2MenuAppUi::ReadSettings()
	{
	TInt err=KErrNone;
	iSettings.Reset();
	if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KSettingPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
		{
		TBuf<255> val;
		RFile filesave;
		TBuf<10> t;
		TFileText ft;
		TUint32 IntVal;
		filesave.Open(CEikonEnv::Static()->FsSession(), KSettingPath, EFileRead);
		ft.Set(filesave);
		while (ft.Read(val)==KErrNone)
			{
			TLex conv(val);
			conv.Val(IntVal,EDecimal);
			iSettings.Append(IntVal);
			}
		filesave.Close();
		}
	else
		{
		TParse parse;
		CEikonEnv::Static()->FsSession().Parse(KSettingPath,parse);
		if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
			{
			CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
			}
		iSettings.Append(KPosXP);
		iSettings.Append(KPosYP);
		iSettings.Append(KPosXL);
		iSettings.Append(KPosYL);
		iSettings.Append(KSize);
		WriteSettings();
		}
	}
开发者ID:kolayuk,项目名称:Tap2Menu,代码行数:37,代码来源:Tap2MenuAppUi.cpp


示例16: LogIt

void TTimerLogger::LogIt(const TDesC& aComment)
	{
	TInt err = iFs.Connect();
	if(err == KErrNone)
		{
		iFs.MkDirAll(KFilePath);
		err = iFile.Open(iFs, KFileName, EFileWrite);
		if(err == KErrNotFound)
			{
			iFile.Create(iFs, KFileName, EFileWrite);
			iFile.Write(KTestHeader);
			iFile.Write(KTestLogs);
			}
		TFileText file;
	    file.Set(iFile);
		file.Write(aComment);
		iFile.Close();
		iFs.Close();
		}
	else	
		{
		User::InfoPrint(_L("Cannot write to file"));
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:24,代码来源:TimerLogger.cpp


示例17: CALLSTACKITEM_N

EXPORT_C void bases::test(COperatorMap* aOpMap, CCellMap* aCellMap)
{
	CALLSTACKITEM_N(_CL("bases"), _CL("test"));

#ifdef __WINS__ 
	aOpMap->AddRef();

	iTimer->Reset();

	testing=true; bool first=true;
	test_flags=0;
	scale=1.0; proportion=0.9;
	learning_done=false;

	RFile testf;
	TFileText test;
	int ts_len=15;
	TBuf<128> filen;
	TBuf<256> line;
	TBuf<30> id_d, dt_d;
	filen.Append(DataDir());
	filen.Append(_L("bases_test_data.txt"));

	op=Cfile_output_base::NewL(AppContext(), _L("bases"));
	Cfile_output_base& o=*op;

	CBBSensorEvent e(KCell, KCellIdTuple);
	TBBCellId cell(KCell);
	e.iData.SetValue(&cell); e.iData.SetOwnsValue(EFalse);

	if (testf.Open(Fs(), filen, 
		EFileShareAny | EFileStreamText | EFileRead)==KErrNone) {
		CleanupClosePushL(testf);
		test.Set(testf);
		int j=0;
	

		//int beg=23000, end=230000;
		int beg=0, end=0;

		while ( test.Read(line) == KErrNone && j < end) {
		//for (int i=0;i<TEST_DATA_COUNT; i++) {
			if (! (j % 1000) ) {
				TBuf<40> msg;
				msg.Format(_L("Testing at %d"), j);
				RDebug::Print(msg);
			}
			j++;
			if (j>=beg) {
				dt_d=line.Left(ts_len);
				id_d=line.Mid(ts_len+1);
				
				TTime time(dt_d);
				now=time;
				if (first) { 
					previous_time=now; first_time=now; first=false; 
					previous_day=previous_time;
				}
				if (! id_d.Compare(_L("SWITCH"))) {
					started=true;
				} else {
					e.iStamp()=time;
					CCellMap::Parse(id_d, cell.iCellId(), cell.iLocationAreaCode(), cell.iShortName());
					if (cell.iCellId()==0 && cell.iLocationAreaCode()==0) {
						cell.iMCC()=0;
						cell.iMNC()=0;
					} else {
						aOpMap->NameToMccMnc(cell.iShortName(), cell.iMCC(),
 cell.iMNC());
					}
					cell.iMappedId()=aCellMap->GetId(cell);
					NewSensorEventL(KNoTuple, KNullDesC, e); // name is ignored
				}
			}
		}
		CleanupStack::PopAndDestroy(); // testf
	}

	e.iData.SetValue(0);

	if (! (test_flags & NO_DB_UPDATE) ) {
		read_from_database(false, 0);
	}

	line.Format(_L("total %f\n"), total_t);
	o.write_to_output(line);
	cell_list_node* n=first_cell;
	while (n) {
		TInt base=0;
		if (n->is_base) base=1;
		line.Format(_L("%d: t %f f %d cum_t %f base %d merged to %d\n"),
			n->id, n->t, n->f, n->cum_t, base, n->merged_to);
		o.write_to_output(line);
		n=n->next;
	}

	o.write_to_output(_L("MAPPINGS:\n"));
	aCellMap->PrintMapping(o);

	delete op;
//.........这里部分代码省略.........
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:101,代码来源:bases.cpp


示例18: INFO_PRINTF1

/**
   @SYMTestCaseID UIF-ETUL-0009

   @SYMREQ 7736
 
   @SYMTestCaseDesc Test to Parse for URI's, Email Addresses, Phone Numbers and URL's in a file and to verify them
  
   @SYMTestPriority High 
 
   @SYMTestStatus Implemented
  
   @SYMTestActions Constructs CTulAddressStringTokenizer object with CTulAddressStringTokenizer::EFindItemSearchMailAddressBin \n
   which parses the given string and creates an item array consisting of all the Email addresses\n
   API Calls:\n	
   CTulAddressStringTokenizer::NewL(const TDesC& aText, TInt aSearchCases);\n
   CTulAddressStringTokenizer::Item(SFoundItem& aItem); \n
   CTulAddressStringTokenizer::NextItem(SFoundItem& aItem); \n   
  
   @SYMTestExpectedResults The test checks whether 
   1. Phone numbers, Email addresses, URL's and URI's  parsed by CTulAddressStringTokenizer are the correct ones.
 */
void CT_AddressStringTokenizerStep::ParseURIFileL()
    {
	INFO_PRINTF1(_L("Test begins"));
    __UHEAP_MARK;

    //load test case text to string
    RFs rfs;
    User::LeaveIfError(rfs.Connect());
    CleanupClosePushL(rfs);
 	_LIT(KParesTextFile, "z:\\system\\data\\addressstringtokenizertestappdata.txt");
	_LIT(KParesTextFileRef, "z:\\system\\data\\addressstringtokenizertestappdataref.txt");

    RFile file;
    HBufC* fullBuf = HBufC::NewMaxLC(KFullBufSize);
    TPtr fullBufPtr = fullBuf->Des();                  
    fullBufPtr = KNullDesC;

	TFileText reader;
    TBuf<KReadBufSize> fileBuffer;

	if ((file.Open(rfs, KParesTextFile, EFileStreamText|EFileRead|EFileShareAny)) == KErrNone)
		{
		CleanupClosePushL(file);
        // use TFileText for reading file. There is probably better ways to do this tho.
        reader.Set(file);
        if (reader.Seek(ESeekStart))
			{
			INFO_PRINTF1(_L("File corrupted"));
            User::Leave(KErrGeneral); // not cleaning up properly
            }

        while (!reader.Read(fileBuffer))
		    {
		    fullBufPtr.Append(fileBuffer);
		    fullBufPtr.Append('\n');   
		    }
		CleanupStack::Pop(&file);    
        file.Close();
        }
    else
        {
		INFO_PRINTF1(_L("z:\\system\\data\\addressstringtokenizertestappdata.txt not found"));
		User::Leave(KErrNotFound);
  	   }

	if (file.Open(rfs, KParesTextFileRef, EFileStreamText|EFileRead|EFileShareAny) == KErrNone)
		{
		CleanupClosePushL(file);
        // use TFileText for reading file. There is probably better way to do this tho.
        reader.Set(file);
        if (reader.Seek(ESeekStart))
			{
			INFO_PRINTF1(_L("File corrupted"));
            User::Leave(KErrGeneral); // not cleaning up properly
            }
		}
    else
        {
		INFO_PRINTF1(_L("z:\\system\\data\\addressstringtokenizertestappdataref.txt not found"));
		User::Leave(KErrNotFound);
        }

    INFO_PRINTF1(_L("Start searching..."));
                
    // Create an instance of Address String Tokenizer and search for URL's.
    CTulAddressStringTokenizer* addressString = CTulAddressStringTokenizer::NewL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchURLBin);
    TestAddressStringTokenizers(addressString, reader, fullBufPtr);
    delete addressString;

    // find phone numbers from same text
    addressString = CTulAddressStringTokenizer::NewL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchPhoneNumberBin);
    TestAddressStringTokenizers(addressString, reader, fullBufPtr);
	
    // test do new search with same instance
    TInt count = addressString->DoNewSearchL(fullBufPtr, CTulAddressStringTokenizer::EFindItemSearchMailAddressBin);
  	TEST(count > 0);
  	TestAddressStringTokenizers(addressString, reader, fullBufPtr);
    delete addressString;
                
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:t_addressstringtokenizer.cpp


示例19: GetSectionData

EXPORT_C TInt TEFparser::GetSectionData(TDesC& aScriptFilepath, TPtrC& aSectiontag, TDesC16 &aTocspTestFile, RFs& aFs)
	{
	
	TInt err = KErrNone;	
	TInt pos = 0;
	RFile file;
	
	// open the .ini file
	if (BaflUtils::FolderExists(aFs, aScriptFilepath))
		{		
		if (BaflUtils::FileExists( aFs, aScriptFilepath ))
			{	
			file.Open(aFs, aScriptFilepath, EFileRead | EFileShareAny);
			
			TFileText aLineReader;
			TBuf<256> iLine;
			TBuf<256> tempsectID;

			// create the section name to search for
			tempsectID.Copy(KOpenBrk);
			tempsectID.Append(aSectiontag);
			tempsectID.Append(KCloseBrk);
			
			// read the ini file a line at a time until you find the the section name
			aLineReader.Set(file);		
			TInt foundTag = -1;
			while (err != KErrEof && foundTag != 0)
				{
				err = aLineReader.Read(iLine);
				if (err != KErrEof)
					foundTag =  iLine.Find(tempsectID);
				}
			
			// create the next open bracket to search for		
			TBuf<2> tempopenBrk;
			tempopenBrk.Copy(KOpenBrk);
			
			RFile testfile;	
			err = KErrNone;
			foundTag = -1;

			// while not at the end of the file and not found the next open bracket
			while (err != KErrEof && foundTag != 0)
				{

				// get the next line of the .ini file
				err = aLineReader.Read(iLine);
				if (err != KErrEof)
					{

					// if the line of the file doesn't contain an open bracket, we are still in the section body
					foundTag =  iLine.Find(tempopenBrk);
					if (BaflUtils::FolderExists(aFs, aTocspTestFile) && foundTag != 0)
						{		
						// open the test file we are going to write all our section info into
						if (BaflUtils::FileExists( aFs, aTocspTestFile ))
							{	
							testfile.Open(aFs, aTocspTestFile, EFileWrite|EFileShareAny);
							testfile.Seek(ESeekEnd, pos);
							}
						else
							{	
							User::LeaveIfError(testfile.Create(aFs, aTocspTestFile, EFileWrite|EFileShareAny));
							testfile.Open(aFs, aTocspTestFile, EFileWrite|EFileShareAny);
							}
						// append to line of the file end of line characters
						iLine.Append(_L("\r\n"));

						// write line of the code out to the test file in UNICODE format 
						TPtrC8 tmpPoint((TText8*)iLine.Ptr(),iLine.Size());
						testfile.Write(tmpPoint); 
						
						testfile.Flush();							
						}
					testfile.Close();
					}
				}
			}
		}
		return KErrNone;

	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:82,代码来源:TEFparser.cpp


示例20: pj_symbianos_get_model_info

PJ_END_DECL


/* Get Symbian phone model info, returning length of model info */
unsigned pj_symbianos_get_model_info(char *buf, unsigned buf_size)
{
    pj_str_t model_name;

    /* Get machine UID */
    TInt hal_val;
    HAL::Get(HAL::EMachineUid, hal_val);
    pj_ansi_snprintf(buf, buf_size, "0x%08X", hal_val);
    pj_strset2(&model_name, buf);

    /* Get model name */
    const pj_str_t st_copyright = {"(C)", 3};
    const pj_str_t st_nokia = {"Nokia", 5};
    char tmp_buf[64];
    pj_str_t tmp_str;

    _LIT(KModelFilename,"Z:\\resource\\versions\\model.txt");
    RFile file;
    RFs fs;
    TInt err;
    
    fs.Connect(1);
    err = file.Open(fs, KModelFilename, EFileRead);
    if (err == KErrNone) {
	TFileText text;
	text.Set(file);
	TBuf16<64> ModelName16;
	err = text.Read(ModelName16);
	if (err == KErrNone) {
	    TPtr8 ptr8((TUint8*)tmp_buf, sizeof(tmp_buf));
	    ptr8.Copy(ModelName16);
	    pj_strset(&tmp_str, tmp_buf, ptr8.Length());
	    pj_strtrim(&tmp_str);
	}
	file.Close();
    }
    fs.Close();
    if (err != KErrNone)
	goto on_return;
    
    /* The retrieved model name is usually in long format, e.g: 
     * "© Nokia N95 (01.01)", "(C) Nokia E52". As we need only
     * the short version, let's clean it up.
     */
    
    /* Remove preceding non-ASCII chars, e.g: "©" */
    char *p = tmp_str.ptr;
    while (!pj_isascii(*p)) { p++; }
    pj_strset(&tmp_str, p, tmp_str.slen - (p - tmp_str.ptr));
    
    /* Remove "(C)" */
    p = pj_stristr(&tmp_str, &st_copyright);
    if (p) {
	p += st_copyright.slen;
	pj_strset(&tmp_str, p, tmp_str.slen - (p - tmp_str.ptr));
    }

    /* Remove "Nokia" */
    p = pj_stristr(&tmp_str, &st_nokia);
    if (p) {
	p += st_nokia.slen;
	pj_strset(&tmp_str, p, tmp_str.slen - (p - tmp_str.ptr));
    }
    
    /* Remove language version, e.g: "(01.01)" */
    p = pj_strchr(&tmp_str, '(');
    if (p) {
	tmp_str.slen = p - tmp_str.ptr;
    }
    
    pj_strtrim(&tmp_str);
    
    if (tmp_str.slen == 0)
	goto on_return;
    
    if ((unsigned)tmp_str.slen > buf_size - model_name.slen - 3)
	tmp_str.slen = buf_size - model_name.slen - 3;
    
    pj_strcat2(&model_name, "(");
    pj_strcat(&model_name, &tmp_str);
    pj_strcat2(&model_name, ")");
    
    /* Zero terminate */
    buf[model_name.slen] = '\0';
    
on_return:
    return model_name.slen;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:92,代码来源:os_info_symbian.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TFitResultPtr类代码示例发布时间:2022-05-31
下一篇:
C++ TFileStream类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap