本文整理汇总了C++中ConfigMap::setFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigMap::setFlags方法的具体用法?C++ ConfigMap::setFlags怎么用?C++ ConfigMap::setFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigMap
的用法示例。
在下文中一共展示了ConfigMap::setFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool Settings::load()
{
#ifdef TARGET_ROBOT
robot = NaoBody().getName();
#else
robot = "Nao";
#endif
bool loadedSettingsFromFile = false;
#ifdef TARGET_ROBOT
// load settings from team.cfg
try
{
ConfigMap teams;
if(teams.read("teams.cfg", false, &ConfigMap::printOnErr) >= 0)
{
teams.setFlags(teams.getFlags() | ConfigMap::READONLY);
std::vector<std::string> keys = teams.getKeys();
for(std::vector<std::string>::const_iterator i = keys.begin(), end = keys.end(); i != end; ++i)
{
const ConfigValue& teamValue = teams[*i];
if(teamValue.getType() != ConfigValue::MAP)
continue;
const ConfigMap& team = teamValue;
if(!team.hasKey("players"))
continue;
const ConfigValue& playersValue = team["players"];
if(playersValue.getType() != ConfigValue::LIST)
continue;
const ListConfigValue& players = playersValue;
for(int i = 0, len = players.length(); i < len; ++i)
{
const ConfigValue& playersValue = players[i];
if(playersValue.getType() != ConfigValue::PLAIN)
continue;
if(((const PlainConfigValue&)playersValue).str() == robot)
{
playerNumber = i + 1;
team["number"] >> teamNumber;
teamPort = 10001 + teamNumber * 100;
team["location"] >> location;
std::string entryName;
team["color"] >> entryName;
if(entryName == "blue")
teamColor = TEAM_BLUE;
else if(entryName == "red")
teamColor = TEAM_RED;
else
ASSERT(false);
loadedSettingsFromFile = true;
goto loadedTeamsCfg;
}
}
}
loadedTeamsCfg:
;
}