本文整理汇总了C++中YamlNode::AsMap方法的典型用法代码示例。如果您正苦于以下问题:C++ YamlNode::AsMap方法的具体用法?C++ YamlNode::AsMap怎么用?C++ YamlNode::AsMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YamlNode
的用法示例。
在下文中一共展示了YamlNode::AsMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
bool HierarchyTreePlatformNode::Save(YamlNode* node)
{
YamlNode* platform = new YamlNode(YamlNode::TYPE_MAP);
platform->Set(WIDTH_NODE, GetWidth());
platform->Set(HEIGHT_NODE, GetHeight());
Map<String, YamlNode*> &platformsMap = node->AsMap();
platformsMap[GetName().toStdString()] = platform;
ActivatePlatform();
Map<String, YamlNode*> &platformMap = platform->AsMap();
YamlNode* screens = new YamlNode(YamlNode::TYPE_ARRAY);
platformMap[SCREENS_NODE] = screens;
// Add the Localization info - specific for each Platform.
SaveLocalization(platform);
QString projectFolder = GetResourceFolder();
projectFolder += "UI";
QDir dir;
dir.mkpath(projectFolder);
bool result = true;
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
if (!screenNode)
continue;
QString screenPath = QString(SCREEN_PATH).arg(GetResourceFolder()).arg(screenNode->GetName());
result &= screenNode->Save(screenPath);
screens->AddValueToArray(screenNode->GetName().toStdString());
}
return result;
}
示例2: Save
bool HierarchyTreePlatformNode::Save(YamlNode* node, bool saveAll)
{
YamlNode* platform = new YamlNode(YamlNode::TYPE_MAP);
platform->Set(WIDTH_NODE, GetWidth());
platform->Set(HEIGHT_NODE, GetHeight());
MultiMap<String, YamlNode*> &platformsMap = node->AsMap();
platformsMap.erase(GetName().toStdString());
platformsMap.insert(std::pair<String, YamlNode*>(GetName().toStdString(), platform));
ActivatePlatform();
MultiMap<String, YamlNode*> &platformMap = platform->AsMap();
YamlNode* screens = new YamlNode(YamlNode::TYPE_ARRAY);
platformMap.erase(SCREENS_NODE);
platformMap.insert(std::pair<String, YamlNode*>(SCREENS_NODE, screens));
YamlNode* aggregators = new YamlNode(YamlNode::TYPE_MAP);
platformMap.erase(AGGREGATORS_NODE);
platformMap.insert(std::pair<String, YamlNode*>(AGGREGATORS_NODE, aggregators));
// Add the Localization info - specific for each Platform.
SaveLocalization(platform);
QString platformFolder = GetPlatformFolder();
QDir dir;
dir.mkpath(platformFolder);
bool result = true;
//save aggregators node before save screens
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeAggregatorNode* node = dynamic_cast<HierarchyTreeAggregatorNode*>(*iter);
if (!node)
continue;
QString path = QString(SCREEN_PATH).arg(platformFolder).arg(node->GetName());
MultiMap<String, YamlNode*> &aggregatorsMap = aggregators->AsMap();
YamlNode* aggregator = new YamlNode(YamlNode::TYPE_MAP);
result &= node->Save(aggregator, path, saveAll);
aggregatorsMap.erase(node->GetName().toStdString());
aggregatorsMap.insert(std::pair<String, YamlNode*>(node->GetName().toStdString(), aggregator));
}
for (HIERARCHYTREENODESCONSTITER iter = GetChildNodes().begin();
iter != GetChildNodes().end();
++iter)
{
HierarchyTreeAggregatorNode* node = dynamic_cast<HierarchyTreeAggregatorNode*>(*iter);
if (node)
continue; //skip aggregators
HierarchyTreeScreenNode* screenNode = dynamic_cast<HierarchyTreeScreenNode*>(*iter);
if (!screenNode)
continue;
QString screenPath = QString(SCREEN_PATH).arg(platformFolder).arg(screenNode->GetName());
result &= screenNode->Save(screenPath, saveAll);
screens->AddValueToArray(screenNode->GetName().toStdString());
}
return result;
}