本文整理汇总了C++中token::isString方法的典型用法代码示例。如果您正苦于以下问题:C++ token::isString方法的具体用法?C++ token::isString怎么用?C++ token::isString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类token
的用法示例。
在下文中一共展示了token::isString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: token
Foam::token Foam::functionEntries::ifeqEntry::expand
(
const dictionary& dict,
const string& keyword,
const token& t
)
{
if (keyword[0] == '$')
{
word varName = keyword(1, keyword.size()-1);
// lookup the variable name in the given dictionary
const entry* ePtr = dict.lookupScopedEntryPtr
(
varName,
true,
true
);
if (ePtr)
{
return token(ePtr->stream());
}
else
{
// String expansion. Allow unset variables
string expanded(keyword);
stringOps::inplaceExpand(expanded, dict, true, true);
// Re-form as a string token so we can compare to string
return token(expanded, t.lineNumber());
}
}
else if (!t.isString())
{
// Re-form as a string token so we can compare to string
return token(keyword, t.lineNumber());
}
else
{
return t;
}
}
示例2: expand
Foam::token Foam::functionEntries::ifeqEntry::expand
(
const dictionary& dict,
const token& t
)
{
if (t.isWord())
{
return expand(dict, t.wordToken(), t);
}
else if (t.isVariable())
{
return expand(dict, t.stringToken(), t);
}
else if (t.isString())
{
return expand(dict, t.stringToken(), t);
}
else
{
return t;
}
}
示例3: if
bool Foam::functionEntries::ifeqEntry::equalToken
(
const token& t1,
const token& t2
)
{
const bool eqType = (t1.type() == t2.type());
switch (t1.type())
{
case token::UNDEFINED:
return eqType;
case token::PUNCTUATION:
return (eqType && t1.pToken() == t2.pToken());
case token::WORD:
if (eqType)
{
return t1.wordToken() == t2.wordToken();
}
else if (t2.isString())
{
return t1.wordToken() == t2.stringToken();
}
else
{
return false;
}
case token::STRING:
case token::VARIABLE:
case token::VERBATIMSTRING:
if (eqType)
{
return t1.stringToken() == t2.stringToken();
}
else if (t2.isWord())
{
return t1.stringToken() == t2.wordToken();
}
else
{
return false;
}
case token::LABEL:
if (eqType)
{
return t1.labelToken() == t2.labelToken();
}
else if (t2.isScalar())
{
return t1.labelToken() == t2.scalarToken();
}
else
{
return false;
}
case token::FLOAT_SCALAR:
if (eqType)
{
return equal(t1.floatScalarToken(), t2.floatScalarToken());
}
else if (t2.isScalar())
{
return t1.scalarToken() == t2.scalarToken();
}
else
{
return false;
}
case token::DOUBLE_SCALAR:
if (eqType)
{
return equal(t1.doubleScalarToken(), t2.doubleScalarToken());
}
else if (t2.isScalar())
{
return t1.scalarToken() == t2.scalarToken();
}
else
{
return false;
}
case token::LONG_DOUBLE_SCALAR:
if (eqType)
{
return equal
(
t1.longDoubleScalarToken(),
t2.longDoubleScalarToken()
);
}
else if (t2.isScalar())
{
return t1.scalarToken() == t2.scalarToken();
//.........这里部分代码省略.........