• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/xml/xpath/XPath.h

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef _xpath_h
00018 #define _xpath_h
00019 
00020 #include <spl/types.h>
00021 #include <spl/collection/Array.h>
00022 #include <spl/Debug.h>
00023 #include <spl/Memory.h>
00024 #include <spl/collection/List.h>
00025 #include <spl/RefCountPtr.h>
00026 #include <spl/String.h>
00027 #include <spl/xml/XmlNode.h>
00028 #include <spl/xml/XmlNodeList.h>
00029 #include <spl/xml/xpath/private/XPathOperator.h>
00030 
00036 class XPath;
00037 typedef RefCountPtr<XPath> XPathPtr;
00038 
00053 class XPath : public IMemoryValidate
00054 {
00055 private:
00056         Array<XPathOperatorPtr> m_ops;
00057         
00058 protected:
00059         static XmlNodeListPtr SelectNodes(Array<XPathOperatorPtr>&ops, XmlNodePtr context, bool findAll);
00060         
00061         inline XmlNodeListPtr SelectNodes(XmlNodePtr context, bool findAll)
00062         {
00063                 return SelectNodes(m_ops, context, findAll);
00064         }
00065         
00066 public:
00067         XPath();
00068         XPath(const String& xp);
00069         XPath(const XPath& xp);
00070         virtual ~XPath();
00071         
00072         XPath& operator =(const XPath& xp);
00073         
00074         XmlNodeListPtr SelectNodes(XmlNodePtr context);
00075         XmlNodePtr SelectSingleNode(XmlNodePtr context);
00076 
00077         static XmlNodeListPtr SelectNodes(Array<XPathOperatorPtr>&ops, XmlNodePtr context);
00078         
00079 #if defined(DEBUG) || defined(_DEBUG)
00080         void CheckMem() const;
00081         void ValidateMem() const;
00082 #endif
00083 };
00084 
00087 #endif