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 _INPUSTREAM_HXX_ 25 #define _INPUSTREAM_HXX_ 26 27 #include <rtl/ustring.hxx> 28 #include <osl/file.hxx> 29 #include <cppuhelper/weak.hxx> 30 #include <com/sun/star/uno/XInterface.hpp> 31 #include <com/sun/star/io/XSeekable.hpp> 32 #include <com/sun/star/io/XInputStream.hpp> 33 #include <com/sun/star/ucb/XContentProvider.hpp> 34 35 36 namespace chelp { 37 38 // forward declaration 39 40 class XInputStream_impl 41 : public cppu::OWeakObject, 42 public com::sun::star::io::XInputStream, 43 public com::sun::star::io::XSeekable 44 { 45 public: 46 47 XInputStream_impl( const rtl::OUString& aUncPath ); 48 49 virtual ~XInputStream_impl(); 50 51 /** 52 * Returns an error code as given by filerror.hxx 53 */ 54 55 bool SAL_CALL CtorSuccess(); 56 57 virtual com::sun::star::uno::Any SAL_CALL 58 queryInterface( 59 const com::sun::star::uno::Type& rType ); 60 61 virtual void SAL_CALL 62 acquire( 63 void ) 64 throw(); 65 66 virtual void SAL_CALL 67 release( 68 void ) 69 throw(); 70 71 virtual sal_Int32 SAL_CALL 72 readBytes( 73 com::sun::star::uno::Sequence< sal_Int8 >& aData, 74 sal_Int32 nBytesToRead ); 75 76 virtual sal_Int32 SAL_CALL 77 readSomeBytes( 78 com::sun::star::uno::Sequence< sal_Int8 >& aData, 79 sal_Int32 nMaxBytesToRead ); 80 81 virtual void SAL_CALL 82 skipBytes( 83 sal_Int32 nBytesToSkip ); 84 85 virtual sal_Int32 SAL_CALL 86 available( 87 void ); 88 89 virtual void SAL_CALL 90 closeInput( 91 void ); 92 93 virtual void SAL_CALL 94 seek( 95 sal_Int64 location ); 96 97 virtual sal_Int64 SAL_CALL 98 getPosition( 99 void ); 100 101 virtual sal_Int64 SAL_CALL 102 getLength( 103 void ); 104 105 private: 106 107 bool m_bIsOpen; 108 osl::File m_aFile; 109 }; 110 111 112 } // end namespace XInputStream_impl 113 114 #endif 115