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


C++ TFileName::Compare方法代码示例

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


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

示例1: ConstructL

/**
 * @brief Completes the second phase of Symbian object construction.
 * Put initialization code that could leave here.
 */
void Csymbian_ua_guiAppUi::ConstructL()
{
    // [[[ begin generated region: do not modify [Generated Contents]
    BaseConstructL (EAknEnableSkin);
    InitializeContainersL();
    // ]]] end generated region [Generated Contents]

    // Create private folder
    RProcess process;
    TFileName path;

    path.Copy (process.FileName().Left (2));

    if (path.Compare (_L ("c")) || path.Compare (_L ("C")))
        CEikonEnv::Static()->FsSession().CreatePrivatePath (EDriveC);
    else if (path.Compare (_L ("e")) || path.Compare (_L ("E")))
        CEikonEnv::Static()->FsSession().CreatePrivatePath (EDriveE);

    // Init PJSUA
    if (symbian_ua_init() != 0) {
        symbian_ua_destroy();
        Exit();
    }

    ExecuteDlg_wait_initLD();

    CTimer::ConstructL();
    CActiveScheduler::Add (this);
    After (4000000);
}
开发者ID:max3903,项目名称:SFLphone,代码行数:34,代码来源:symbian_ua_guiAppUi.cpp

示例2: GetDriveLetters

LOCAL_C void GetDriveLetters()
	{
// Assign the first drive that matches the required criteria
	test.Next(_L("T_DENYCLAMP - GetDriveLetters()"));

	TDriveList driveList;
	TDriveInfo driveInfo;
	TInt r=TheFs.DriveList(driveList);
	test(r==KErrNone);
	TInt drvNum;
	TBool drivesFound = EFalse;
	for(drvNum=0; (drvNum<KMaxDrives) && !drivesFound; drvNum++)
		{
		TChar drvLetter='?';
		TFileName fileSystem;
		if(!driveList[drvNum])
			continue;
		test(TheFs.Drive(driveInfo, drvNum) == KErrNone);
		test(TheFs.DriveToChar(drvNum,drvLetter) == KErrNone);
		r=TheFs.FileSystemName(fileSystem,drvNum);
		fileSystem.UpperCase();
		test((r==KErrNone)||(r==KErrNotFound));
		// Check for FAT on NAND
		if(NandFatDrv=='?')
			{
			if((driveInfo.iType==EMediaNANDFlash) && (fileSystem.Compare(KFATName)==0))
				NandFatDrv=drvLetter;
			}
		// Check for ROFS
		if(RofsDrv=='?')
			{
			if((driveInfo.iType==EMediaNANDFlash) && (fileSystem.Compare(KROFSName)==0))
				RofsDrv=drvLetter;
			}
		// Check for LFFS
		if(LffsDrv=='?')
			{
			if((driveInfo.iType==EMediaFlash) && (fileSystem.Compare(KLFFSName)==0))
				LffsDrv=drvLetter;
			}
		// Check for CompFSys
		if(CompDrv=='?')
			{
			if((driveInfo.iType==EMediaRom) && ((fileSystem.Compare(KROMName)==0)||(fileSystem.Compare(KCOMPName)==0)))
				CompDrv=drvLetter;
			}
		drivesFound=((NandFatDrv!='?')&&(RofsDrv!='?')&&(LffsDrv!='?')&&(CompDrv!='?'));
		}
	if(NandFatDrv!='?')
		test((NandFatDrv!=RofsDrv)&&(NandFatDrv!=LffsDrv)&&(NandFatDrv!=CompDrv));
	if(RofsDrv!='?')
		test((RofsDrv!=LffsDrv)&&(RofsDrv!=CompDrv));
	if(LffsDrv!='?')
		test(LffsDrv!=CompDrv);

	RDebug::Printf("T_DENYCLAMP: FAT drive=%C, ROFS drive=%C, LFFS drive=%C, ROM-COMP drive=%C \n",(TText)NandFatDrv,(TText)RofsDrv,(TText)LffsDrv,(TText)CompDrv);
	return;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:58,代码来源:t_denyclamp.cpp

示例3: TestSEGetTextL

// -----------------------------------------------------------------------------
// CTestSDKEditors::TestSEGetTextL
// -----------------------------------------------------------------------------
//
TInt CTestSDKEditors::TestSEGetTextL( CStifItemParser& /*aItem*/ )
    {
    CEikSecretEditor* secretEditor = new (ELeave) CEikSecretEditor;
    CleanupStack::PushL( secretEditor );
    STIF_ASSERT_NOT_NULL( secretEditor );
    
    TResourceReader reader;
    CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_SECRETTEXT );
    secretEditor->ConstructFromResourceL( reader );
    CleanupStack::PopAndDestroy();
    
    _LIT( KText, "Text" );
    TFileName text( KText );
    secretEditor->SetText( text );
    
    TFileName textGet;
    secretEditor->GetText( textGet );
    
    STIF_ASSERT_EQUALS( 0, textGet.Compare( text ) );
    
    CleanupStack::PopAndDestroy( secretEditor );
    
    return KErrNone;
    
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:29,代码来源:testsdkeditorsblockssecrettext.cpp

示例4: LoadScalableIconsL

void LoadScalableIconsL(CArrayPtrFlat<CGulIcon> * aIconList, const TIconID* aIconDefs, TInt aNbIcons)
{
	CALLSTACKITEMSTATIC_N(_CL("JuikIcons"), _CL("LoadScalableIconsL"));
#ifdef __SCALABLEUI_VARIANT__
	TFileName real; 
	TFileName prev;
	
	CEikonEnv* env=CEikonEnv::Static();
	RFs& fs=env->FsSession();
	
	CWsScreenDevice* screen=CEikonEnv::Static()->ScreenDevice();
	
	// Loop through icon ids
	for (int i = 0; i<aNbIcons;i++)
		{
			
			TPtrC file((TText16*)aIconDefs[i].iMbmFile);
			
			
			// Decide file only if previous file wasn't same 
			if (prev.Compare(file)) {
				FigureOutRealPathL(file, real, fs);			
				prev=file;			
			}
			
			auto_ptr<CGulIcon> icon( LoadScalableIconL(real, aIconDefs[i].iBitmap, aIconDefs[i].iMask, screen) );
			aIconList->AppendL(icon.get()); 
			icon.release();
			}
#endif 
	
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:32,代码来源:juik_icons.cpp

示例5: TestCLResourceFile

// ============================ MEMBER FUNCTIONS ===============================
// =========================== CLASS CEikCoCtlLibrary===========================
// -----------------------------------------------------------------------------
// CTestSDKInitialization::TestCLResourceFile
// -----------------------------------------------------------------------------
TInt CTestSDKInitialization::TestCLResourceFile( CStifItemParser& /*aItem*/ )
    {
    TFileName fileName = CEikCtlLibrary::ResourceFile();
    _LIT(KFileName,"z:\\resource\\eikctl.rsc");
    STIF_ASSERT_TRUE( 0 == fileName.Compare( KFileName ) );
    return KErrNone;
    
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:13,代码来源:testsdkinitializationblocksct.cpp

示例6: TestLeadingE5Handling

void TestLeadingE5Handling()
	{
	test.Next(_L("Test Leading \'E5\' byte handling"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	// Enables codepage dll implementation of LocaleUtils functions for this test only
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	r=TheFs.SessionPath(gSessionPath);
	testAndLog(r==KErrNone);

	_LIT(KTestFilePathAndName,		"\\F32-TST\\T_FATCHARSETCONV\\\x88F9.TXT");
	_LIT(KTestFileShortName, 		"\x88F9.TXT");
	
	MakeFile(KTestFilePathAndName);
	TFileName sn;
	r = TheFs.GetShortName(KTestFilePathAndName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestFileShortName);
	testAndLog(r==KErrNone);
	
	r=TheFs.Delete(KTestFilePathAndName);
	testAndLog(r==KErrNone);

	// Disables codepage dll implementation of LocaleUtils functions for other base tests
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:46,代码来源:t_fatcharsetconv_SpecificCases.cpp

示例7: SetDiscussionIdL

void CDiscussion::SetDiscussionIdL(const TDesC& aDiscussionId) {
	// Rename existing cache file
	RFs aSession = CCoeEnv::Static()->FsSession();
	TFileName aOldFilePath = GetFileName(aSession);
	
	if(iDiscussionId) {
		delete iDiscussionId;
	}
	
	iDiscussionId = aDiscussionId.AllocL();
	
	TFileName aNewFilePath = GetFileName(aSession);
	
	if(aNewFilePath.Compare(aOldFilePath) != 0) {
		aSession.Rename(aOldFilePath, aNewFilePath);
	}
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:17,代码来源:DiscussionManager.cpp

示例8: LoadIcons

EXPORT_C void LoadIcons(CArrayPtrFlat<CGulIcon> * aIconList, const TIconID* aIconDefs, 
			TInt aNbIcons, TInt aScale)
{
	CALLSTACKITEM_N(_CL(""), _CL("LoadIcons"));

	TFileName real; TFileName prev;
	CEikonEnv* env=CEikonEnv::Static();
	RFs& fs=env->FsSession();
	CWsScreenDevice* screen=env->ScreenDevice();
	RWsSession& ws=env->WsSession();
	RArray<TInt> Offsets; RFile File; bool file_is_open=false;
	CleanupClosePushL(Offsets);
	RFileReadStream s;
	int j=0;

	bool romfile=false;
	for (int i = 0; i<aNbIcons;i++)
	{
		TPtrC file((TText16*)aIconDefs[i].iMbmFile);
#ifdef __S60V3__
		if (file.FindF(_L("avkon"))==KErrNotFound) {
#endif
			
		if (prev.Compare(file)) {
#ifndef __S60V3__
			real=file;
#else
			TParse p; p.Set(file, 0, 0);
			real=_L("c:\\resource\\");
			real.Append(p.NameAndExt());				
				
#endif

#ifdef __WINS__
			real.Replace(0, 1, _L("z"));
#else
			if (! BaflUtils::FileExists(fs, real)) {
				real.Replace(0, 1, _L("e"));
			}
#endif
			prev=file;
			if (file_is_open) {
				s.Close();
				file_is_open=false;
			}
			if (real.Left(1).CompareF(_L("z"))==0) {
				romfile=true;
			} else {
				romfile=false;
				GetIconInfo(real, fs, File, s, Offsets, j);
				file_is_open=true;
			}
			++j;
		}

		auto_ptr<CWsBitmap> bitmap(new (ELeave) CWsBitmap(ws));
		if (!romfile) {
			RFile f1=File;
			s.Attach(f1, Offsets[aIconDefs[i].iBitmap]);	
			bitmap->InternalizeL(s);
		} else {
			TInt err=bitmap->Load(real, aIconDefs[i].iBitmap);
			if (err!=KErrNone) 
				User::Leave(err);
		}
		bitmap->SetSizeInTwips(screen);
#ifdef __S60V2__
		if (aScale>1) {
			auto_ptr<CWsBitmap> scaled(new (ELeave) CWsBitmap(ws));
			ScaleFbsBitmapL(bitmap.get(), scaled.get(), aScale);
			bitmap=scaled;
		}
#endif
		
		auto_ptr<CWsBitmap> mask(NULL);
		if ( aIconDefs[i].iMask != KErrNotFound )
			{
				mask.reset(new (ELeave) CWsBitmap(ws));
				if (!romfile) {
					RFile f2=File;
					s.Attach(f2, Offsets[aIconDefs[i].iMask]);
					mask->InternalizeL(s);
				} else {
					User::LeaveIfError(mask->Load(real, aIconDefs[i].iMask));
				}
				mask->SetSizeInTwips(screen);
#ifdef __S60V2__
				if (aScale>1) {
					auto_ptr<CWsBitmap> scaled(new (ELeave) CWsBitmap(ws));
					ScaleFbsBitmapL(mask.get(), scaled.get(), aScale);
					mask=scaled;
				}
#endif
			}

		auto_ptr<CGulIcon> icon(CGulIcon::NewL(bitmap.get(), mask.get()));
		bitmap.release(); mask.release();
		aIconList->AppendL(icon.get()); icon.release();
#ifdef __S60V3__
		} else {
//.........这里部分代码省略.........
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:101,代码来源:icons.cpp

示例9: TestVFATCase2

void TestVFATCase2()
	{
	test.Next(_L("Test With VFAT entry, and DOS entry using CP932 Japanese file's access"));
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));

	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	test_KErrNone(r);
		
	r = UserSvr::ChangeLocale(KTestLocale);
	test_KErrNone(r);
	r=TheFs.SetSessionPath(gSessionPath);
	testAndLog(r==KErrNone);
	
	_LIT(KTestNormalFileName, 		"\x65B0\x6587\x4EF6.TXT");	
	_LIT(KTestNormalFileShortName, 	"\x65B0\x6587\x4EF6.TXT");
	
	test.Printf(_L("Create a file with the DLL installed, and get the shortname"));
	r=TheFile.Create(TheFs,KTestNormalFileName,EFileRead|EFileWrite);
	testAndLog(r==KErrNone);
	TFileName sn;
	r = TheFs.GetShortName(KTestNormalFileName, sn);
	testAndLog(r==KErrNone);
	r = sn.Compare(KTestNormalFileShortName);
	testAndLog(r==0);
	TheFile.Close();
	
	test.Printf(_L("Access the file with the DLL installed"));
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);
	
	TBuf<50> name;	
	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	
	test.Printf(_L("Access the file without the DLL installed"));
	
	r=TheFile.Open(TheFs,KTestNormalFileName,EFileWrite);
	testAndLog(r==KErrNone);

	r=TheFile.FullName(name);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFile.Open(TheFs,KTestNormalFileShortName,EFileWrite);
	testAndLog(r==KErrNone);
	TheFile.Close();
	
	r=TheFs.Delete(KTestNormalFileName);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:71,代码来源:t_fatcharsetconv_SpecificCases.cpp

示例10: TestIllegalCharsWithDll

void TestIllegalCharsWithDll()
	{
	test.Next(_L("Test Illegal Character handling with DLL"));			
	__UHEAP_MARK;
	
	// logging for failure
	gTCType = ESymbianFATSpecific;
	RBuf failedOnBuf;
	failedOnBuf.CreateL(gLogFailureData.iFuncName);
	gTCId = 0;
	RBuf tcUniquePath;
	tcUniquePath.CreateL(KNone());

	QuickFormat();
	CreateTestDirectory(_L("\\F32-TST\\T_FATCHARSETCONV\\"));
	
	TInt r = TheFs.ControlIo(CurrentDrive(), KControlIoEnableFatUtilityFunctions);
	testAndLog(r==KErrNone);

	r = UserSvr::ChangeLocale(KTestLocale);
	testAndLog(r==KErrNone);

	_LIT(KTestNormalUnicodeFileName, 				"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestNormalUnicodeFileNameShortDefualt, 	"\x65B0\x6587\x4EF6.TXT");
	_LIT(KTestFileNameWithIllegalChars, 			"\x222F\x2F3A\x3C3E\x7C00.TXT");
	_LIT(KFileNameWithIllegalCharsShort, 			"___\x7C00.TXT");
	_LIT(KTestFileNameWithWildChars, 				"\x235B\x245C\x255D\x265E.TXT");
	_LIT(KTestFileNameWithWildCharsShort, 			"____.TXT");

	TFileName shn;

	MakeFile(KTestNormalUnicodeFileName);
	r = TheFs.GetShortName(KTestNormalUnicodeFileName, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KTestNormalUnicodeFileNameShortDefualt);
	testAndLog(r==0);

	TFileName lgn;
	r = TheFs.GetLongName(KTestNormalUnicodeFileNameShortDefualt, lgn);
	testAndLog(r==KErrNone);
	r = lgn.Compare(KTestNormalUnicodeFileName);
	testAndLog(r==0);

	// Test illegal 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithIllegalChars);
	r = TheFs.GetShortName(KTestFileNameWithIllegalChars, shn);
	testAndLog(r==KErrNone);
	r = shn.Compare(KFileNameWithIllegalCharsShort);
	testAndLog(r==0);
	
	// Test wildcards, 8-bit ASCII chars in 16-bit Unicode chars.
	MakeFile(KTestFileNameWithWildChars);
	r = TheFs.GetShortName(KTestFileNameWithWildChars, shn);
	test_KErrNone(r);
	r = shn.Compare(KTestFileNameWithWildCharsShort);
	testAndLog(r==0);
	
	r=TheFs.Delete(KTestFileNameWithIllegalChars);
	testAndLog(r==0);
	r=TheFs.Delete(KTestNormalUnicodeFileName);
	testAndLog(r==0);
	r=TheFs.Delete(KTestFileNameWithWildChars);
	testAndLog(r==0);
	
	r = TheFs.ControlIo(CurrentDrive(), KControlIoDisableFatUtilityFunctions);
	testAndLog(r==KErrNone);
	failedOnBuf.Close();
	tcUniquePath.Close();
	__UHEAP_MARKEND;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:70,代码来源:t_fatcharsetconv_SpecificCases.cpp

示例11: FsReplaceL

void CPreModifierPlugin::FsReplaceL(TFsPluginRequest& aRequest)
	{
	TFileName oldfilename;
	TFileName newfilename;

	oldfilename = aRequest.Src().FullName();
	newfilename = aRequest.Dest().FullName();

	TBuf<256> testfilename1;

	//setting up test files
	testfilename1.Append(iDriveToTest);
	testfilename1.Append(_L(":\\Data\\test.txt"));

    	
	if (aRequest.IsPostOperation())
		{
		//STF: Is this code going to get called - the pre-operation completes early?

		_LOG(_L("CPreModifierPlugin::FsReplaceL, post intercept"));
		//We should check that the name has changed here.
		RFilePlugin file(aRequest);
		TInt err = file.AdoptFromClient();
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL

		TInt compare = oldfilename.Compare(newfilename);
		if(compare != 0) //is equal
			{
			//User::Leave(compare);
			//It wont be equal as the name is coming from the request aint it.
			//Pointless comparison then eh?
			}

		file.Close();

		RFilePlugin fileplugin2(aRequest);
		//open a second file
		err = fileplugin2.Open(testfilename1, EFileWrite);
		_LOG3(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Open for %S returned %d"), &testfilename1, err);
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL
								
		TInt64 size=0;
		err =fileplugin2.Size(size);
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL

		//close the second file
		fileplugin2.Close();
		_LOG2(_L("CPreModifierPlugin::FsReplaceL, RFilePlugin::Close to the second file returned %d"), err);
		}
	else
		{
		User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:63,代码来源:premodifier_plugin.cpp


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