本文整理汇总了C++中ASTNode::getExtendedType方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::getExtendedType方法的具体用法?C++ ASTNode::getExtendedType怎么用?C++ ASTNode::getExtendedType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNode
的用法示例。
在下文中一共展示了ASTNode::getExtendedType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readMathMLFromStringWithNamespaces
END_TEST
START_TEST (test_element_selector)
{
const char* s = wrapMathML
(
" <apply>"
" <selector/>"
" <ci> A </ci>"
" <ci> i </ci>"
" </apply>"
);
N = readMathMLFromStringWithNamespaces(s, NS);
fail_unless( N != NULL );
fail_unless( N->getType() == AST_ORIGINATES_IN_PACKAGE);
fail_unless( N->getExtendedType() == AST_LINEAR_ALGEBRA_SELECTOR);
fail_unless( N->getNumChildren() == 2);
fail_unless( N->getPackageName() == "arrays");
ASTNode * child = N->getChild(0);
fail_unless( child != NULL );
fail_unless( child->getType() == AST_NAME);
fail_unless( child->getExtendedType() == AST_NAME);
fail_unless( strcmp(child->getName(), "A") == 0);
fail_unless( child->getNumChildren() == 0);
fail_unless( child->getPackageName() == "core");
child = N->getChild(1);
fail_unless( child != NULL );
fail_unless( child->getType() == AST_NAME);
fail_unless( child->getExtendedType() == AST_NAME);
fail_unless( strcmp(child->getName(), "i") == 0);
fail_unless( child->getNumChildren() == 0);
ArraysASTPlugin* plugin = static_cast<ArraysASTPlugin*>(N->getPlugin("arrays"));
fail_unless(plugin != NULL);
fail_unless(plugin->getASTType() == AST_LINEAR_ALGEBRA_SELECTOR);
}
示例2: if
bool
ArraysASTPlugin::hasCorrectNumberArguments(int type) const
{
bool correctNumArgs = true;
ASTBase* function = const_cast<ASTBase*>(getMath());
// so getMath will only return teh node if it is a vector or matrix
if (function == NULL)
{
function = const_cast<ASTBase*>(getParentASTObject());
if (function == NULL)
{
return false;
}
}
// cast the function to an ASTNode
ASTNode * newAST = dynamic_cast<ASTNode*>(function);
// double check we are working with the right thing
if (newAST == NULL)
{
return false;
}
else if (newAST->getExtendedType() != type)
{
return false;
}
unsigned int numChildren = newAST->getNumChildren();
switch (type)
{
case AST_LINEAR_ALGEBRA_SELECTOR:
if (numChildren < 1 || numChildren > 3)
{
correctNumArgs = false;
}
break;
default:
break;
}
return correctNumArgs;
}