1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 * 14 */ 15 16 #include "XMLObject.hxx" 17 #include "XMLDocument.hxx" 18 #include "XMLElement.hxx" 19 #include "XMLXPath.hxx" 20 #include "XMLNodeSet.hxx" 21 #include "VariableScope.hxx" 22 23 namespace org_modules_xml 24 { XMLXPath(const XMLDocument & _doc,xmlXPathObject * _xpath)25XMLXPath::XMLXPath(const XMLDocument & _doc, xmlXPathObject * _xpath): XMLObject(), doc(_doc) 26 { 27 xpath = _xpath; 28 scope->registerPointers(xpath, this); 29 id = scope->getVariableId(*this); 30 } 31 ~XMLXPath()32XMLXPath::~XMLXPath() 33 { 34 scope->unregisterPointer(xpath); 35 scope->removeId(id); 36 } 37 getRealXMLPointer() const38void *XMLXPath::getRealXMLPointer() const 39 { 40 return static_cast < void *>(xpath); 41 } 42 getXMLObjectParent() const43const XMLObject *XMLXPath::getXMLObjectParent() const 44 { 45 return &doc; 46 } 47 getNodeSet() const48const XMLNodeSet *XMLXPath::getNodeSet() const 49 { 50 XMLObject *obj = scope->getXMLObjectFromLibXMLPtr(xpath->nodesetval); 51 if (obj) 52 { 53 return static_cast < XMLNodeSet * >(obj); 54 } 55 56 return new XMLNodeSet(doc, xpath); 57 } 58 } 59