本文整理汇总了C++中TMap::CountUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::CountUsed方法的具体用法?C++ TMap::CountUsed怎么用?C++ TMap::CountUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMap
的用法示例。
在下文中一共展示了TMap::CountUsed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoParse
static void DoParse(const char *filename)
{
if (TokenMap.CountUsed() == 0)
{
InitTokenMap();
}
FScanner sc;
void *parser;
int tokentype;
int lump;
bool failed;
ZCCToken value;
lump = Wads.CheckNumForFullName(filename, true);
if (lump >= 0)
{
sc.OpenLumpNum(lump);
}
else if (FileExists(filename))
{
sc.OpenFile(filename);
}
else
{
Printf("Could not find script lump '%s'\n", filename);
return;
}
parser = ZCCParseAlloc(malloc);
failed = false;
#ifdef _DEBUG
FILE *f = fopen("trace.txt", "w");
char prompt = '\0';
ZCCParseTrace(f, &prompt);
#endif
ZCCParseState state(sc);
while (sc.GetToken())
{
value.SourceLoc = sc.GetMessageLine();
switch (sc.TokenType)
{
case TK_StringConst:
value.String = state.Strings.Alloc(sc.String, sc.StringLen);
tokentype = ZCC_STRCONST;
break;
case TK_NameConst:
value.Int = sc.Name;
tokentype = ZCC_NAMECONST;
break;
case TK_IntConst:
value.Int = sc.Number;
tokentype = ZCC_INTCONST;
break;
case TK_UIntConst:
value.Int = sc.Number;
tokentype = ZCC_UINTCONST;
break;
case TK_FloatConst:
value.Float = sc.Float;
tokentype = ZCC_FLOATCONST;
break;
case TK_Identifier:
value.Int = FName(sc.String);
tokentype = ZCC_IDENTIFIER;
break;
case TK_NonWhitespace:
value.Int = FName(sc.String);
tokentype = ZCC_NWS;
break;
default:
TokenMapEntry *zcctoken = TokenMap.CheckKey(sc.TokenType);
if (zcctoken != NULL)
{
tokentype = zcctoken->TokenType;
value.Int = zcctoken->TokenName;
}
else
{
sc.ScriptMessage("Unexpected token %s.\n", sc.TokenName(sc.TokenType).GetChars());
goto parse_end;
}
break;
}
ZCCParse(parser, tokentype, value, &state);
if (failed)
{
sc.ScriptMessage("Parse failed\n");
goto parse_end;
}
}
parse_end:
//.........这里部分代码省略.........