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


C++ Path::ParentPath方法代码示例

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


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

示例1: GetSubFiles

const QStringList FileCompressDlg::GetSubFiles(const Path &path)
{
	QStringList sub_paths;
	QDir dir(QString::fromLocal8Bit(path.ParentPath().c_str()));
	auto entry_list = dir.entryInfoList(QDir::Files);
	auto file_name = path.Stem();
	for (int i = 0; i < entry_list.size(); i++) {
		QString entry_path = entry_list[i].absoluteFilePath();
		Path sub_path = Path(entry_path.toLocal8Bit().toStdString());
		if ((sub_path.Stem() == file_name
			|| QString::fromStdString(sub_path.Stem()).contains(path.FileName().c_str()))
			&& path.String() != sub_path.String())
			sub_paths.push_back(entry_path);
	}

	return sub_paths;
}
开发者ID:xiangling1991,项目名称:xiangling,代码行数:17,代码来源:FileCompressDlg.cpp

示例2: TestBuildFile

// returns 0 on success, -ve number of errors if there is an error and we should quit,
// positive number of errors if there is an error but we should continue
static int TestBuildFile( ICompilerLogger* pLog, RuntimeObjectSystem* pRTObjSys, const Path& file,
                          ITestBuildNotifier* callback, bool bTestFileTracking )
{
    assert( callback );

    if( pLog ) { pLog->LogInfo("Testing change to file: %s\n", file.c_str()); }

    int numErrors = 0;
    if( file.Exists() )
    {
        if( bTestFileTracking )
        {
            FileSystemUtils::filetime_t currTime = FileSystemUtils::GetCurrentTime();
            FileSystemUtils::filetime_t oldModTime = file.GetLastWriteTime();
            if( currTime == oldModTime )
            {
                // some files may be auto-generated by the program, so may have just been created so won't
                // get a time change unless we force it.
                currTime += 1;
            }
            file.SetLastWriteTime( currTime );
            // we must also change the directories time, as some of our watchers watch the dir
            Path directory = file.ParentPath();
            directory.SetLastWriteTime( currTime );
            for( int i=0; i<50; ++i )
            {
                // wait up to 100 seconds (make configurable?)
                pRTObjSys->GetFileChangeNotifier()->Update( 1.0f ); // force update by using very large time delta
                if( pRTObjSys->GetIsCompiling() ) { break; }
                if( !callback->TestBuildWaitAndUpdate() )
                {
                    return -0xD1E;
                }
            }
        }
        else
        {
            AUDynArray<const char*> filelist;
            filelist.Add( file.c_str() );
            pRTObjSys->OnFileChange( filelist );
        }
        if( pRTObjSys->GetIsCompiling() )
        {
            while( !pRTObjSys->GetIsCompiledComplete() )
            {
                if( !callback->TestBuildWaitAndUpdate() )
                {
                    return -0xD1E;
                }
            }
            int numCurrLoadedModules = pRTObjSys->GetNumberLoadedModules();
            if( pRTObjSys->LoadCompiledModule() )
            {
                if( !callback->TestBuildCallback( file.c_str(), TESTBUILDRRESULT_SUCCESS ) ) { return -0xD1E; }
                return 0;
            }
            else
            {
                ++numErrors;
                if( pRTObjSys->GetNumberLoadedModules() == numCurrLoadedModules )
                {
                    if( !callback->TestBuildCallback( file.c_str(), TESTBUILDRRESULT_BUILD_FAILED ) ) { return -numErrors; }
                }
                else
                {
                    // loaded the module but some other issue
                    if( !callback->TestBuildCallback( file.c_str(), TESTBUILDRRESULT_OBJECT_SWAP_FAIL ) ) { return -numErrors; }
                }
            }
        }
        else
        {
            ++numErrors;
           if( !callback->TestBuildCallback( file.c_str(), TESTBUILDRRESULT_BUILD_NOT_STARTED ) ) { return -numErrors; }
        }
    }
    else
    {
        ++numErrors;
        if( !callback->TestBuildCallback( file.c_str(), TESTBUILDRRESULT_BUILD_FILE_GONE ) ) { return -numErrors; }
    }
    return numErrors;
}
开发者ID:piaoasd123,项目名称:ServerTest,代码行数:85,代码来源:RuntimeObjectSystem.cpp


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