本文整理汇总了C++中KeyValues::back方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::back方法的具体用法?C++ KeyValues::back怎么用?C++ KeyValues::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Entity_parseTokens
static NodeSmartReference Entity_parseTokens (Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser,
int index)
{
NodeSmartReference entity(g_nullNode);
KeyValues keyValues;
std::string classname = "";
int count_primitives = 0;
while (1) {
std::string token = tokeniser.getToken();
if (token.empty()) {
Tokeniser_unexpectedError(tokeniser, token, "#entity-token");
return g_nullNode;
}
if (token == "}") { // end entity
if (entity == g_nullNode) {
// entity does not have brushes
entity = Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, false),
keyValues);
}
return entity;
} else if (token == "{") { // begin primitive
if (entity == g_nullNode) {
// entity has brushes
entity
= Entity_create(entityTable, GlobalEntityClassManager().findOrInsert(classname, true),
keyValues);
}
NodeSmartReference primitive(parser.parsePrimitive(tokeniser));
if (primitive == g_nullNode || !Node_getMapImporter(primitive)->importTokens(tokeniser)) {
globalErrorStream() << "brush " << count_primitives << ": parse error\n";
return g_nullNode;
}
scene::Traversable* traversable = Node_getTraversable(entity);
if (Node_getEntity(entity)->isContainer() && traversable != 0) {
traversable->insert(primitive);
} else {
globalErrorStream() << "entity " << index << ": type " << classname << ": discarding brush "
<< count_primitives << "\n";
}
++count_primitives;
} else { // epair
const std::string key = token;
token = tokeniser.getToken();
if (token.empty()) {
Tokeniser_unexpectedError(tokeniser, token, "#epair-value");
return g_nullNode;
}
keyValues.push_back(KeyValues::value_type(key, token));
if (key == "classname")
classname = keyValues.back().second;
}
}
// unreachable code
return g_nullNode;
}