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() throw (RuntimeException); 71 72 /** 73 get the nodes from a nodelist type object 74 */ 75 virtual Reference< XNodeList > SAL_CALL getNodeList() 76 throw (RuntimeException); 77 78 /** 79 get value of a boolean object 80 */ 81 virtual sal_Bool SAL_CALL getBoolean() throw (RuntimeException); 82 83 /** 84 get number as byte 85 */ 86 virtual sal_Int8 SAL_CALL getByte() throw (RuntimeException); 87 88 /** 89 get number as short 90 */ 91 virtual sal_Int16 SAL_CALL getShort() throw (RuntimeException); 92 93 /** 94 get number as long 95 */ 96 virtual sal_Int32 SAL_CALL getLong() throw (RuntimeException); 97 98 /** 99 get number as hyper 100 */ 101 virtual sal_Int64 SAL_CALL getHyper() throw (RuntimeException); 102 103 /** 104 get number as float 105 */ 106 virtual float SAL_CALL getFloat() throw (RuntimeException); 107 108 /** 109 get number as double 110 */ 111 virtual double SAL_CALL getDouble() throw (RuntimeException); 112 113 /** 114 get string value 115 */ 116 virtual OUString SAL_CALL getString() throw (RuntimeException); 117 118 }; 119 } 120 121 #endif 122