MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathBooleanFunction

Function xmlXPathBooleanFunction

ThirdParty/libxml2/vtklibxml2/xpath.c:8397–8411  ·  view source on GitHub ↗

* xmlXPathBooleanFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the boolean() XPath function * boolean boolean(object) * The boolean function converts its argument to a boolean as follows: * - a number is true if and only if it is neither positive or * negative zero nor NaN * - a node-set is true if and only if it is non-empty

Source from the content-addressed store, hash-verified

8395 * - a string is true if and only if its length is non-zero
8396 */
8397void
8398xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs) {
8399 xmlXPathObjectPtr cur;
8400
8401 CHECK_ARITY(1);
8402 cur = valuePop(ctxt);
8403 if (cur == NULL) XP_ERROR(XPATH_INVALID_OPERAND);
8404 if (cur->type != XPATH_BOOLEAN) {
8405 int boolval = xmlXPathCastToBoolean(cur);
8406
8407 xmlXPathReleaseObject(ctxt->context, cur);
8408 cur = xmlXPathCacheNewBoolean(ctxt, boolval);
8409 }
8410 valuePush(ctxt, cur);
8411}
8412
8413/**
8414 * xmlXPathNotFunction:

Callers 2

xmlXPathCompOpEvalFunction · 0.85

Calls 5

valuePopFunction · 0.85
xmlXPathCastToBooleanFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85
xmlXPathCacheNewBooleanFunction · 0.85
valuePushFunction · 0.85

Tested by

no test coverage detected