本文整理汇总了C++中ConfigNode::addValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigNode::addValue方法的具体用法?C++ ConfigNode::addValue怎么用?C++ ConfigNode::addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigNode
的用法示例。
在下文中一共展示了ConfigNode::addValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setParameter
void Material::setParameter(const std::string & name,const std::vector<std::string> & value)
{
ConfigNode * child = root->findChild(name,false);
if(child == NULL)
{
child = new ConfigNode(root,name);
}
child->clearValues();
std::vector<std::string>::const_iterator it = value.begin();
while(it != value.end())
{
child->addValue(*it);
it++;
}
}
示例2: _parseNodes
void ConfigLoader::_parseNodes(std::ifstream &stream, ConfigNode *parent)
{
typedef std::pair<std::string, ConfigNode*> ScriptItem;
while (true)
{
switch (tok)
{
//Node
case TOKEN_Text:
//Add the new node
ConfigNode *newNode;
if (parent)
{
newNode = parent->addChild(tokVal);
}
else
{
newNode = new ConfigNode(0, tokVal);
}
//Get values
_nextToken(stream);
while (tok == TOKEN_Text)
{
newNode->addValue(tokVal);
_nextToken(stream);
}
//Add root nodes to scriptList
if (!parent){
std::string key;
if (newNode->getValues().empty())
{
key = newNode->getName() + ' ';
}
else
{
key = newNode->getName() + ' ' + newNode->getValues().front();
}
m_scriptList.insert(ScriptItem(key, newNode));
}
_skipNewLines(stream);
//Add any sub-nodes
if (tok == TOKEN_OpenBrace)
{
//Parse nodes
_nextToken(stream);
_parseNodes(stream, newNode);
//Check for matching closing brace
if (tok != TOKEN_CloseBrace)
{
throw std::runtime_error("Parse Error: Expecting closing brace");
}
_nextToken(stream);
_skipNewLines(stream);
}
break;
//Out of place brace
case TOKEN_OpenBrace:
throw std::runtime_error("Parse Error: Opening brace out of plane");
break;
//Return if end of nodes have been reached
case TOKEN_CloseBrace:
return;
//Return if reached end of file
case TOKEN_EOF:
return;
case TOKEN_NewLine:
_nextToken(stream);
break;
}
};
}