本文整理汇总了C++中Token::Int方法的典型用法代码示例。如果您正苦于以下问题:C++ Token::Int方法的具体用法?C++ Token::Int怎么用?C++ Token::Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::Int方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: String
bool
Token::operator==(Token &ref) const {
// Compare types, then data if necessary
if (Type() == ref.Type()) {
switch (Type()) {
case CharacterString:
// printf(" str1 == '%s'\n", String());
// printf(" str2 == '%s'\n", ref.String());
// printf(" strcmp() == %d\n", strcmp(String(), ref.String()));
{
return String() == ref.String();
/*
// strcmp() seems to choke on certain, non-normal ASCII chars
// (i.e. chars outside the usual alphabets, but still valid
// as far as ASCII is concerned), so we'll just compare the
// strings by hand to be safe.
const char *str1 = String();
const char *str2 = ref.String();
int len1 = strlen(str1);
int len2 = strlen(str2);
// printf("len1 == %d\n", len1);
// printf("len2 == %d\n", len2);
if (len1 == len2) {
for (int i = 0; i < len1; i++) {
// printf("i == %d, str1[%d] == %x, str2[%d] == %x\n", i, i, str1[i], i, str2[i]);
if (str1[i] != str2[i])
return false;
}
}
return true;
*/
}
// return strcmp(String(), ref.String()) == 0;
case Integer:
return Int() == ref.Int();
case FloatingPoint:
return Float() == ref.Float();
default:
return true;
}
} else
return false;
}
示例2: ColorMask
// ColorMask 0 | RGBA
NodePtr Parser::ColorMask(std::unique_ptr<ParserNode> left, const Token & tok)
{
ngfx::BlendState* BS = ExtractBlend(left.get());
if (LookAhead(Token::TOK_INTEGER)) {
Token mask = Consume();
BS->renderTargets[0].colorWriteMask = mask.Int();
} else if (LookAhead(Token::TOK_IDENTIFIER)) {
auto cmTok = Consume().Str();
if(!ParseColorMask(cmTok, BS->renderTargets[0])) {
SpawnError("Failed to parse ColorMask value", "Any of 'RGBA' here");
return left;
}
} else {
SpawnError("Failed to parse ColorMask", "Expected Integer or Any of 'RGBA' here");
return left;
}
return left;
}