本文整理汇总了C++中Pairs::TagExists方法的典型用法代码示例。如果您正苦于以下问题:C++ Pairs::TagExists方法的具体用法?C++ Pairs::TagExists怎么用?C++ Pairs::TagExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pairs
的用法示例。
在下文中一共展示了Pairs::TagExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LineToResult
bool LineToResult(
const vector<string> tokens,
ResultType& res,
unsigned& rno,
unsigned& bno,
bool skipNameCheck)
{
if (! TokenToUnsigned(tokens[0], 1, 0, "round number", rno))
{
error.no = RETURN_ROUND_NUMBER;
return false;
}
if (! TokenToUnsigned(tokens[1], 1, 0, "board number", bno))
{
error.no = RETURN_BOARD_NUMBER;
return false;
}
res.north = tokens[2];
if (! skipNameCheck && ! pairs.TagExists(res.north))
{
error.flag = true;
error.no = RETURN_PLAYER_NORTH;
error.message << "Got North player: '" << res.north <<
"' (not in name list)\n";
return false;
}
res.east = tokens[3];
if (! skipNameCheck && ! pairs.TagExists(res.east))
{
error.flag = true;
error.no = RETURN_PLAYER_EAST;
error.message << "Got East player: '" << res.east <<
"' (not in name list)\n";
return false;
}
res.south = tokens[4];
if (! skipNameCheck && ! pairs.TagExists(res.south))
{
error.flag = true;
error.no = RETURN_PLAYER_SOUTH;
error.message << "Got South player: '" << res.south <<
"' (not in name list)\n";
return false;
}
res.west = tokens[5];
if (! skipNameCheck && ! pairs.TagExists(res.west))
{
error.flag = true;
error.no = RETURN_PLAYER_WEST;
error.message << "Got West player: '" << res.west <<
"' (not in name list)\n";
return false;
}
size_t cl = tokens[6].size();
if (cl == 0 || cl > 4)
{
error.flag = true;
error.no = RETURN_CONTRACT_FORMAT_TEXT;
error.message << "Got contract: '" << tokens[6].c_str() <<
"' (bad length)\n";
return false;
}
if (cl == 1)
{
if (tokens[6] != "P" && tokens[6] != "p")
{
error.flag = true;
error.no = RETURN_CONTRACT_FORMAT_TEXT;
error.message << "Got contract: '" << tokens[6].c_str() <<
"' (if length 1, must be P or p)\n";
return false;
}
res.level = 0;
return true;
}
if (! CharToLevel(tokens[6][0], res.level))
{
error.flag = true;
error.no = RETURN_LEVEL;
error.message << "Got contract: '" << tokens[6].c_str() <<
"' (can't find a level 1 .. 7)\n";
return false;
}
if (! CharToDenom(tokens[6][1], res.denom))
{
error.flag = true;
error.no = RETURN_DENOM;
error.message << "Got contract: '" << tokens[6].c_str() <<
"' (can't find a denomination, want NSHDC/nshdc)\n";
return false;
}
if (cl == 3)
{
//.........这里部分代码省略.........