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


C++ BoostPath::empty方法代码示例

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


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

示例1: execute

void SaveProjectAsCommand::execute(void)
{
	std::vector<WindowEventProducer::FileDialogFilter> KEProjectFileFilters;
	KEProjectFileFilters.push_back(WindowEventProducer::FileDialogFilter("Project File","xml"));
	KEProjectFileFilters.push_back(WindowEventProducer::FileDialogFilter("All Files","*"));


	//Project File
	BoostPath InitialProjectFilePath(MainApplication::the()->getProject()->getFilePath());
	if(!boost::filesystem::exists(InitialProjectFilePath))
	{
        const Char8* ProjectName(getName(MainApplication::the()->getProject()));
        InitialProjectFilePath = BoostPath(std::string("./") + 
                                           ( ProjectName ? ProjectName : "Project") +
                                           ".xml");
	}

	BoostPath ProjectFilePath;
    ProjectFilePath = MainApplication::the()->getMainWindow()->saveFileDialog("Save Project As ...",KEProjectFileFilters,InitialProjectFilePath.filename(),InitialProjectFilePath.parent_path(), true);

    if(!ProjectFilePath.empty())
    {
        if(ProjectFilePath.extension().empty())
        {
            ProjectFilePath = ProjectFilePath.string() + ".xml";
        }
	    MainApplication::the()->saveProject(ProjectFilePath);
	}
}
开发者ID:djkabala,项目名称:KabalaEngine,代码行数:29,代码来源:KESaveProjectAsCommand.cpp

示例2: getChild

boost::any LuaGraphTreeModel::getChild(const boost::any& parent, const UInt32& index) const
{
    try
    {
        BoostPath ThePath = boost::any_cast<BoostPath>(parent);

        if(!ThePath.empty() &&
           boost::filesystem::exists(ThePath))
        {
            boost::filesystem::directory_iterator end_iter;
            UInt32 Count(0);
            for ( boost::filesystem::directory_iterator dir_itr(ThePath); dir_itr != end_iter; ++dir_itr )
            {
                if( isValidFile(dir_itr->path()) )
                {
                    if(Count == index)
                    {
                        return boost::any(dir_itr->path());
                    }
                    ++Count;
                }
            }
        }
        return boost::any();
    }
    catch(boost::bad_any_cast &)
    {
        return boost::any();
    }
}
开发者ID:Langkamp,项目名称:KabalaEngine,代码行数:30,代码来源:KELuaGraphTreeModel.cpp

示例3: handleTreeNodeExport

void handleTreeNodeExport(ActionEventDetails* const details,
                          Tree* const editorTree)
{
    boost::any SelectedComp(editorTree->getLastSelectedPathComponent());

    //Get the tree selection
    try
    {
        FieldContainerTreeModel::ContainerFieldIdPair ThePair(boost::any_cast<FieldContainerTreeModel::ContainerFieldIdPair>(SelectedComp));

        if(ThePair._FieldID == 0 &&
           ThePair._Container != NULL)
        {
            std::vector<WindowEventProducer::FileDialogFilter> ExportFileFilters;
            ExportFileFilters.push_back(WindowEventProducer::FileDialogFilter("Field Container File","xml"));
            ExportFileFilters.push_back(WindowEventProducer::FileDialogFilter("All Files","*"));

            //Export File
            BoostPath InitialFilePath("./Export.xml");

            WindowEventProducer* MainWindow(editorTree->getParentWindow()->getParentDrawingSurface()->getEventProducer());
            BoostPath ExportFilePath;
            ExportFilePath =MainWindow->saveFileDialog("Save Field Container",
                                                       ExportFileFilters,
                                                       InitialFilePath.filename(),
                                                       InitialFilePath.parent_path(),
                                                       true);

            if(!ExportFilePath.empty())
            {
                if(ExportFilePath.extension().empty())
                {
                    ExportFilePath = ExportFilePath.string() + ".xml";
                }

                FCFileType::FCPtrStore Containers;
                Containers.insert(ThePair._Container);

                FCFileType::FCTypeVector IgnoreTypes;

                FCFileHandler::the()->write(Containers,ExportFilePath,IgnoreTypes);
            }
        }
    }
    catch(boost::bad_any_cast &ex)
    {
        SWARNING << ex.what() << std::endl;
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:49,代码来源:OSGFieldContainerEditorDialog.cpp

示例4: getParent

boost::any LuaGraphTreeModel::getParent(const boost::any& node) const
{
    try
    {
        BoostPath ThePath = boost::any_cast<BoostPath>(node);

        if((!ThePath.empty() ||
            ThePath == getInternalRoot() ||
            boost::filesystem::equivalent(ThePath, getInternalRoot())) &&
           (boost::filesystem::exists(ThePath) && boost::filesystem::exists(getInternalRoot())))
        {
            return boost::any(ThePath.parent_path());
        }

    }
    catch(boost::bad_any_cast &)
    {
    }
    return boost::any();
}
开发者ID:Langkamp,项目名称:KabalaEngine,代码行数:20,代码来源:KELuaGraphTreeModel.cpp

示例5: getIndexOfChild

UInt32 LuaGraphTreeModel::getIndexOfChild(const boost::any& parent, const boost::any& child) const
{
    try
    {
        BoostPath ParentPath = boost::any_cast<BoostPath>(parent);
        BoostPath ChildPath = boost::any_cast<BoostPath>(child);

        if(!ParentPath.empty() &&
           boost::filesystem::exists(ParentPath))
        {
            boost::filesystem::directory_iterator end_iter;
            UInt32 Count(0);
            for ( boost::filesystem::directory_iterator dir_itr( ParentPath ); dir_itr != end_iter; ++dir_itr )
            {
                try
                {
                    if(ChildPath == dir_itr->path() || boost::filesystem::equivalent(dir_itr->path(), ChildPath))
                    {
                        return Count;
                    }
                }
                catch(boost::filesystem::filesystem_error &)
                {
                    return Count;
                }
                if(isValidFile(dir_itr->path()))
                {
                    ++Count;
                }
            }
        }
        return 0;
    }
    catch(boost::bad_any_cast &)
    {
        return 0;
    }
}
开发者ID:Langkamp,项目名称:KabalaEngine,代码行数:38,代码来源:KELuaGraphTreeModel.cpp


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