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


C++ ConfigManager::save方法代码示例

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


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

示例1: func


//.........这里部分代码省略.........
                        const ComponentsByType& components = i->second->getComponentsByType();
                        for( ComponentsByType::const_iterator j = components.begin(); 
                            j != components.end(); ++j )
                        {
                            pluginManager.getPlugin<ClientObjectManager>().getObject( i->first ).destroyComponent( j->first );
                        }
                    }
                    catch ( Exception e )
                    {
                        LOGE << "Could not destroy object: " << e.getDescription();
                    }
                }
            }
            if (ch=='l' || ch=='L')
            {
                // List all objects.
                LOGI << "Listing all objects:";

                const Objects& objects = pluginManager.getPlugin<ClientObjectManager>().getObjects();
                for( Objects::const_iterator i = objects.begin(); i != objects.end(); ++i )
                {
                    LOGI    << "[" << i->second->getName() << "]"
                            << " T:" << i->second->getNetworkingType()
                            << " S:" << i->second->getSource()
                            << " SID:" << i->second->GetCreatingSystemGUID().g
                            //<< " Pos: " << ( i->second->hasComponent<Position>() ? i->second->getComponent<Position>().get( "Position" ).to<Vector3>() : "No position" )
                            << " Parent: " << ( i->second->hasParent() ? i->second->getParent()->getName() : "No parent" );
                }
            }
            if (ch=='r' || ch=='R')
            {
                // Change all objects to remote.
                LOGI << "Setting all objects to remote.";

                const Objects& objects = pluginManager.getPlugin<ClientObjectManager>().getObjects();
                for( Objects::const_iterator i = objects.begin(); i != objects.end(); ++i )
                {
                    try
                    {
                        i->second->setNetworkingType( REMOTE );
                    }
                    catch ( Exception e )
                    {
                        LOGE << "Could not set object to remote: " << e.getDescription();
                    }
                }
            }
            if (ch=='t' || ch=='T')
            {
                // Change all objects to local.
                LOGI << "Setting all objects to local.";

                const Objects& objects = pluginManager.getPlugin<ClientObjectManager>().getObjects();
                for( Objects::const_iterator i = objects.begin(); i != objects.end(); ++i )
                {
                    try
                    {
                        i->second->setNetworkingType( LOCAL );
                    }
                    catch ( Exception e )
                    {
                        LOGE << "Could not set object to local: " << e.getDescription();
                    }
                }
            }
            if (ch=='s' || ch=='S')
            {
                // Change position for all objects.
                LOGI << "Setting position for all position components.";

                const Objects& objects = pluginManager.getPlugin<ClientObjectManager>().getObjects();
                for( Objects::const_iterator i = objects.begin(); i != objects.end(); ++i )
                {
                    /*try
                    {
                        Vector3 random = Vector3( Math::RangeRandom( -1337.0, 1337.0 ) );
                        camp::Value val = random;
                        i->second->getComponent<Position>().set( "Position", 
                           val );
                    }
                    catch ( Exception e )
                    {
                        LOGE << "Could not set position: " << e.getDescription();
                    }*/
                }
            }
        }

        updateSignal();

        RakSleep( 10 );
    }

    // Remove grid.
    delete gridManager;

    // Config save
    if( configManager.save() )
        LOGE << "Config file was not saved.";
}
开发者ID:Gohla,项目名称:Diversia,代码行数:101,代码来源:ClientMain.cpp


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