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


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

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


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

示例1: RequestCreateFolder

void CFileEngine::RequestCreateFolder(const TDesC& aParentPath)
{
	//ASSERT(NULL == iParentFolderName);
	delete iParentFolderName;
	iParentFolderName = NULL;
	iParentFolderName = aParentPath.AllocL();

	TFileName szTempParentPath = aParentPath;
	if ( szTempParentPath[ szTempParentPath.Length() - 1 ] != '\\' )
	{
		szTempParentPath.Append( _L("\\") );
	}
	//获取路径深度
	TInt dirDepth = 0;
	const TUint16* pSzTempParentPath = szTempParentPath.Ptr();
	for ( TInt i = 0; i < szTempParentPath.Length(); i ++ )
	{
		if ( pSzTempParentPath[ i ] == '\\' )
		{
			dirDepth ++;
		}
	}
	if ( dirDepth >= 7 )
	{
		iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_CreateFolderNotSupported),*this,ECmdNull);
		delete iParentFolderName;
		iParentFolderName = NULL;
	}
	else
	{
		iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_InputFolderName),KNullDesC,ECmdCreateFolder);
		//iInputEvent = ECmdCreateFolder;
	}
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:34,代码来源:FileEngine.cpp

示例2: currentPath

//static
QFileSystemEntry QFileSystemEngine::currentPath()
{
    TFileName fn;
    QFileSystemEntry ret;
    TInt r = qt_s60GetRFs().SessionPath(fn);
    if(r == KErrNone) {
        //remove terminating slash from non root paths (session path is clean, absolute and always ends in a \)
        if(fn.Length() > 3 && fn[fn.Length() - 1] == '\\')
            fn.SetLength(fn.Length() - 1);
        ret = QFileSystemEntry(qt_TDesC2QString(fn), QFileSystemEntry::FromNativePath());
    }
    return ret;
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:14,代码来源:qfilesystemengine_symbian.cpp

示例3: CheckFileNameAndSetSizes

/**
Function checks the sent parmaters and pancis client if any of its length 
is greater than KMaxFileName. Calculates the padded lengths of sent parameters
and stores them in member variables

@param aResourceDir directory name of animation description file
@param aFilenameOutgoing File name of Outgoing phase of TFX
@param aFilenameIncoming File name of Incoming phase of TFX
*/
void RTFXEffect::CheckFileNameAndSetSizes(const TFileName& aResourceDir, 
		const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming)
	{
	__ASSERT_ALWAYS(aResourceDir.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
	__ASSERT_ALWAYS(aFilenameOutgoing.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
	__ASSERT_ALWAYS(aFilenameIncoming.Length() <= KMaxFileName, Panic(EW32PanicStringTooLong));
	
	iDirPathSizePaded = PaddedValue(aResourceDir.Size());
	iFileName1SizePaded = PaddedValue(aFilenameOutgoing.Size());
	iFileName2SizePaded = PaddedValue(aFilenameIncoming.Size());
	
	iCombSizePaded = iDirPathSizePaded + iFileName1SizePaded + iFileName2SizePaded;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:22,代码来源:rtfxeffect.cpp

示例4: CreateModuleSessionL

/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: CreateModuleSessionL

    Description: Creates a new module session.
    Just take the initialisation file name from message.

    Parameters: const RMessage& aMessage  :inout:   Message to be handled

    Return Values: TInt                             Operation result

    Errors/Exceptions: Leaves if memory allocation fails

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CTestModule::CreateModuleSessionL( const RMessage2& aMessage )
    {

    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession in" ) ) );

    // Take parameters
    TFileName ini;
    TRAPD( res, aMessage.ReadL( 0, ini ) );
    if( res != KErrNone )
        {
        PanicClient( EBadDescriptor, aMessage );
        return res;
        }

    // Construct heap buffer for initialization file name
    iIniBuffer = HBufC::NewL( ini.Length() );
    iIni.Set ( iIniBuffer->Des() );
    iIni.Copy ( ini );

    aMessage.Complete( KErrNone );

    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession out" ) ) );

    return KErrNone;

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

示例5: RemoveDirectory

bool C_dir::RemoveDirectory(const wchar *path, bool recursively){

   bool ok = true;
   if(recursively){
      C_dir d;
      if(d.ScanBegin(path)){
         while(true){
            dword atts;
            const wchar *wp = d.ScanGet(&atts);
            if(!wp)
               break;
            Cstr_w fn; fn<<path <<'\\' <<wp;
            if(atts&C_file::ATT_DIRECTORY)
               ok = (RemoveDirectory(fn, true) && ok);
            else
               ok = (C_file::DeleteFile(fn) && ok);
         }
         d.ScanEnd();
      }
   }
   Cstr_w dirw;
   C_file::GetFullPath(path, dirw);

   RFs file_session;
   RFs &fs = InitFileSession(file_session);
   TFileName n;
   n.Copy(TPtrC((word*)(const wchar*)dirw, dirw.Length()));
   if(n[n.Length()-1]!='\\')
      n.Append('\\');
   ok = (fs.RmDir(n)==KErrNone && ok);
   CloseFileSession(file_session);
   return ok;
}
开发者ID:turbanoff,项目名称:X-plore,代码行数:33,代码来源:Directory.cpp

示例6: AppendMainLogL

TInt CTestUtils::AppendMainLogL()
	{
	_LIT(KDisplayLogFile,"Log File %S\n");
	TParse loglocation;
	TFileName logfile;
	TInt err=ResolveLogFile(KNullDesC, loglocation);
	if(err!=KErrNone) 
		{
		iFs.MkDirAll(KMsvTestFileDefaultOutputBase);
		err=ResolveLogFile(KNullDesC, loglocation);
		}
	User::LeaveIfError(err);
	logfile.Copy(loglocation.FullName());
	logfile.Delete(logfile.Length()-1,1);
	AppendVariantName(logfile);
	iRTest.Printf(KDisplayLogFile, &logfile);
	iFs.MkDirAll(logfile);

	iLogBuf=HBufC::NewL(KMaxLogLineLength);
	iLogBuf8=HBufC8::NewL(KMaxLogLineLength);
	TInt pos=0;
	TInt ret=KErrNone;
	ret=iFile.Open(iFs,logfile,EFileWrite|EFileShareAny);
	if (ret==KErrNotFound)
		ret=iFile.Create(iFs,logfile,EFileWrite|EFileShareAny);
	if (ret==KErrNone)
		return(iFile.Seek(ESeekEnd,pos));
	else
		return(ret);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:30,代码来源:MsvTestUtilsBase.cpp

示例7: OpenMainLogL

TInt CTestUtils::OpenMainLogL()
	{
	_LIT(KDisplayLogFile,"Log File %S\n");
	TParse loglocation;
	TFileName logfile;
	TInt err=ResolveLogFile(KNullDesC, loglocation);
	if(err!=KErrNone) 
		{
		TChar driveChar=RFs::GetSystemDriveChar();
 		TBuf<2> systemDrive;
 		systemDrive.Append(driveChar);
 		systemDrive.Append(KDriveDelimiter);
 		TPath pathName(systemDrive) ;
		pathName.Append(KMsvTestFileDefaultOutputBase);		
		iFs.MkDirAll(pathName);
		err=ResolveLogFile(KNullDesC, loglocation);
		}
	User::LeaveIfError(err);
	logfile.Copy(loglocation.FullName());
	logfile.Delete(logfile.Length()-1,1);
	AppendVariantName(logfile);
	iRTest.Printf(KDisplayLogFile, &logfile);
	iFs.MkDirAll(logfile);

	iLogBuf=HBufC::NewL(KMaxLogLineLength);
	iLogBuf8=HBufC8::NewL(KMaxLogLineLength);
	return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny));
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:28,代码来源:MsvTestUtilsBase.cpp

示例8: TestSEResetL

// -----------------------------------------------------------------------------
// CTestSDKEditors::TestSEResetL
// -----------------------------------------------------------------------------
//
TInt CTestSDKEditors::TestSEResetL( 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 );
    
    secretEditor->Reset();
    
    TFileName textGet;
    secretEditor->GetText( textGet );
    
    STIF_ASSERT_EQUALS( 0, textGet.Length() );
    
    CleanupStack::PopAndDestroy( secretEditor );
    
    return KErrNone;
    
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:31,代码来源:testsdkeditorsblockssecrettext.cpp

示例9: ProcessCommandParametersL

TBool CIncallertAppUi::ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName)
#endif
{
#ifdef EKA2
    if(aCommandLine.OpaqueData().Length() > 0)
#else
    if(aDocumentName.Length() > 0)
#endif
    {
        // Opaque data exists, app. has been manually started from the menu
        iAutoStarted = EFalse;
        iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNormal);
        TApaTask task(iEikonEnv->WsSession( ));
        task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
        task.BringToForeground();
        DoConstuctL();
    }
    else
    {
        iAutoStarted = ETrue;
        if(!CIncallertSettingsView::AutoStartEnabled())
        {
            //prepare exit
            if(!iExitTimer)
            {
                iExitTimer = CPeriodic::NewL(0);
                iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNeverAtFront);
                iExitTimer->Start( 5000000, 5000000, TCallBack(ExitTimerCallBack,this));
            }

#ifdef EKA2
            return CEikAppUi::ProcessCommandParametersL( aCommandLine );
#else
            return CEikAppUi::ProcessCommandParametersL( aCommand,aDocumentName );
#endif
        }

        ////////autostart enabled:
        iEikonEnv->RootWin().SetOrdinalPosition(-1,ECoeWinPriorityNormal);
        DoConstuctL();


        {
            TApaTask task(iEikonEnv->WsSession( ));
            task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
            task.SendToBackground();
        }
        ////////////////
    }

#ifdef EKA2
    return CEikAppUi::ProcessCommandParametersL( aCommandLine );
#else
    return CEikAppUi::ProcessCommandParametersL( aCommand,aDocumentName );
#endif

}
开发者ID:ykasidit,项目名称:Incallert,代码行数:57,代码来源:IncallertAppUi.cpp

示例10: DeleteTestFiles

void DeleteTestFiles()
	{
	if(TheDbName.Length() > 0)
		{
		(void)TheFs.Delete(TheDbName);
		}
	(void)TheFs.Delete(KTestFile3);
	(void)TheFs.Delete(KTestFile);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:9,代码来源:t_sqlfilebuf64.cpp

示例11: getCurrentConfigName

QString ControllerWrapper::getCurrentConfigName()
{
#ifdef Q_OS_SYMBIAN
    TFileName fn;
    d_ptr->GetCurrentConfigName(fn);
    return QString((QChar*)fn.Ptr(),fn.Length());
#elif defined(_SIMULATOR_STUB)
    return QString("");
#endif
}
开发者ID:juhanapaavola,项目名称:swiiplayer,代码行数:10,代码来源:controllerwrapper.cpp

示例12: SetDirectory

void __fastcall TCDirectoryOutline::SetDirectory(const TFileName NewDir)
{
    if (NewDir.Length() > 0) {
        TFileName Path = ForceCase(ExpandFileName(NewDir));
        int n = Path.Length();

        if (n > 3 && Path.IsPathDelimiter(n))
            Path.SetLength(n - 1);

        if (Path != FDirectory) {
            FDirectory = Path;
            chdir(FDirectory.c_str());

            if (!SameLetter(Path[1], Drive))
                Drive = Path[1];
            else {
                WalkTree(Path);
                Change();
            }
        }
    }
}
开发者ID:stievie,项目名称:Martis,代码行数:22,代码来源:cdiroutl.cpp

示例13: MakeDirectory

bool C_dir::MakeDirectory(const wchar *path, bool success_if_exists){

   RFs file_session;
   RFs &fs = InitFileSession(file_session);
   TFileName n;
   n.Copy(TPtrC((word*)path, StrLen(path)));
   if(n[n.Length()-1]!='\\')
      n.Append('\\');
   int err = fs.MkDir(n);
   CloseFileSession(file_session);
   if(success_if_exists && err==KErrAlreadyExists)
      return true;
   return (err==KErrNone);
}
开发者ID:turbanoff,项目名称:X-plore,代码行数:14,代码来源:Directory.cpp

示例14: TRAPD

RArray<TFileName> ListImages::searchJPGL(TFileName tot, RFs fs,
        TFileName current)
{
    RArray<TFileName> result;
    TInt i;
    TBuf<50> totalPath;
    TBuf<30> fileName;
    CDir* dirList;

    totalPath = tot;
    CleanupStack::PushL(dirList);
    if ((current.Length()) > 0)
        totalPath.Append(current);
    //CleanupClosePushL(result);
    TRAPD(err,fs.GetDir(totalPath, KEntryAttMaskSupported,
                        ESortByDate, dirList));
    CleanupStack::Pop(1);
    if (!dirList)
        return result;

    for (i = 0; i < dirList->Count(); i++)
    {
        if ((*dirList)[i].IsDir())
        {
            TFileName tmp;
            tmp.Append((*dirList)[i].iName);
            tmp.Append(_L("\\"));
            RArray<TFileName> res = searchJPGL(totalPath, fs, tmp);
            for (int j = 0; j < res.Count(); j++)
                result.Append(res[j]);
            res.Reset();

        }
        else
        {
            fileName = (*dirList)[i].iName;
            if (fileName.Find(_L(".jpg")) != KErrNotFound)
            {
                TBuf<50> tmp;
                tmp = totalPath;
                tmp.Append(fileName);
                result.Append(tmp);
                tmp.Delete(0, tmp.Length() - 1);
            }
        }
    }
    delete dirList;
    return result;
}
开发者ID:mba3gar,项目名称:SeniorMessageEncryption,代码行数:49,代码来源:CListImage.cpp

示例15: ConstructL

void CGNAppletAppUi::ConstructL(void)
{
	TFileName file;
	int pos;

	BaseConstructL(ENoAppResourceFile);

	file.Copy(Application()->AppFullName());
	pos = file.LocateReverse('\\');
	file.Replace(pos, file.Length() - pos, _L("\\gnapplet.exe"));

	EikDll::StartExeL(file);

	User::Exit(0);
}
开发者ID:AndyLavr,项目名称:gammu,代码行数:15,代码来源:gnapplet_ui.cpp


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