1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef XPATH_XPATHOBJECT_HXX 25 #define XPATH_XPATHOBJECT_HXX 26 27 #include <boost/shared_ptr.hpp> 28 29 #include <libxml/tree.h> 30 #include <libxml/xpath.h> 31 32 #include <sal/types.h> 33 #include <rtl/ref.hxx> 34 35 #include <cppuhelper/implbase1.hxx> 36 37 #include <com/sun/star/uno/Reference.h> 38 #include <com/sun/star/xml/dom/XNodeList.hpp> 39 #include <com/sun/star/xml/xpath/XXPathObject.hpp> 40 41 42 using ::rtl::OUString; 43 using namespace com::sun::star::uno; 44 using namespace com::sun::star::xml::dom; 45 using namespace com::sun::star::xml::xpath; 46 47 48 namespace DOM { 49 class CDocument; 50 } 51 52 namespace XPath 53 { 54 class CXPathObject : public cppu::WeakImplHelper1< XXPathObject > 55 { 56 private: 57 ::rtl::Reference< DOM::CDocument > const m_pDocument; 58 ::osl::Mutex & m_rMutex; 59 boost::shared_ptr<xmlXPathObject> const m_pXPathObj; 60 XPathObjectType const m_XPathObjectType; 61 62 public: 63 CXPathObject( ::rtl::Reference<DOM::CDocument> const& pDocument, 64 ::osl::Mutex & rMutex, 65 ::boost::shared_ptr<xmlXPathObject> const& pXPathObj); 66 67 /** 68 get object type 69 */ 70 virtual XPathObjectType SAL_CALL getObjectType(); 71 72 /** 73 get the nodes from a nodelist type object 74 */ 75 virtual Reference< XNodeList > SAL_CALL getNodeList(); 76 77 /** 78 get value of a boolean object 79 */ 80 virtual sal_Bool SAL_CALL getBoolean(); 81 82 /** 83 get number as byte 84 */ 85 virtual sal_Int8 SAL_CALL getByte(); 86 87 /** 88 get number as short 89 */ 90 virtual sal_Int16 SAL_CALL getShort(); 91 92 /** 93 get number as long 94 */ 95 virtual sal_Int32 SAL_CALL getLong(); 96 97 /** 98 get number as hyper 99 */ 100 virtual sal_Int64 SAL_CALL getHyper(); 101 102 /** 103 get number as float 104 */ 105 virtual float SAL_CALL getFloat(); 106 107 /** 108 get number as double 109 */ 110 virtual double SAL_CALL getDouble(); 111 112 /** 113 get string value 114 */ 115 virtual OUString SAL_CALL getString(); 116 117 }; 118 } 119 120 #endif 121