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

Function xmlXPathContainsFunction

ThirdParty/libxml2/vtklibxml2/xpath.c:7962–7984  ·  view source on GitHub ↗

* xmlXPathContainsFunction: * @ctxt: the XPath Parser context * @nargs: the number of arguments * * Implement the contains() XPath function * boolean contains(string, string) * The contains function returns true if the first argument string * contains the second argument string, and otherwise returns false. */

Source from the content-addressed store, hash-verified

7960 * contains the second argument string, and otherwise returns false.
7961 */
7962void
7963xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs) {
7964 xmlXPathObjectPtr hay, needle;
7965
7966 CHECK_ARITY(2);
7967 CAST_TO_STRING;
7968 CHECK_TYPE(XPATH_STRING);
7969 needle = valuePop(ctxt);
7970 CAST_TO_STRING;
7971 hay = valuePop(ctxt);
7972
7973 if ((hay == NULL) || (hay->type != XPATH_STRING)) {
7974 xmlXPathReleaseObject(ctxt->context, hay);
7975 xmlXPathReleaseObject(ctxt->context, needle);
7976 XP_ERROR(XPATH_INVALID_TYPE);
7977 }
7978 if (xmlStrstr(hay->stringval, needle->stringval))
7979 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt, 1));
7980 else
7981 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt, 0));
7982 xmlXPathReleaseObject(ctxt->context, hay);
7983 xmlXPathReleaseObject(ctxt->context, needle);
7984}
7985
7986/**
7987 * xmlXPathStartsWithFunction:

Callers

nothing calls this directly

Calls 5

valuePopFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85
xmlStrstrFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheNewBooleanFunction · 0.85

Tested by

no test coverage detected