本文整理汇总了C++中EntityKeyValues::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityKeyValues::insert方法的具体用法?C++ EntityKeyValues::insert怎么用?C++ EntityKeyValues::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityKeyValues
的用法示例。
在下文中一共展示了EntityKeyValues::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Quake3MapReader::parseEntity(parser::DefTokeniser& tok)
{
// Map of keyvalues for this entity
EntityKeyValues keyValues;
// The actual entity. This is initially null, and will be created when
// primitives start or the end of the entity is reached
scene::INodePtr entity;
// Start parsing, first token must be an open brace
tok.assertNextToken("{");
std::string token = tok.nextToken();
// Reset the primitive counter, we're starting a new entity
_primitiveCount = 0;
while (true)
{
// Token must be either a key, a "{" to indicate the start of a
// primitive, or a "}" to indicate the end of the entity
if (token == "{") // PRIMITIVE
{
// Create the entity right now, if not yet done
if (entity == NULL)
{
entity = createEntity(keyValues);
}
// Parse the primitive block, and pass the parent entity
parsePrimitive(tok, entity);
}
else if (token == "}") // END OF ENTITY
{
// Create the entity if necessary and return it
if (entity == NULL)
{
entity = createEntity(keyValues);
}
break;
}
else // KEY
{
std::string value = tok.nextToken();
// Sanity check (invalid number of tokens will get us out of sync)
if (value == "{" || value == "}")
{
std::string text = (boost::format(_("Parsed invalid value '%s' for key '%s'")) % value % token).str();
throw FailureException(text);
}
// Otherwise add the keyvalue pair to our map
keyValues.insert(EntityKeyValues::value_type(token, value));
}
// Get the next token
token = tok.nextToken();
}
// Insert the entity
_importFilter.addEntity(entity);
}