Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / cmis / std_inputstream.hxx
blob8d23de87f16a482643220cde95718beb25fbcc7f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_STD_INPUTSTREAM_HXX
11 #define INCLUDED_UCB_SOURCE_UCP_CMIS_STD_INPUTSTREAM_HXX
13 #include <boost/shared_ptr.hpp>
14 #include <istream>
16 #include <osl/mutex.hxx>
17 #include <cppuhelper/weak.hxx>
18 #include <com/sun/star/io/XInputStream.hpp>
19 #include <com/sun/star/io/XSeekable.hpp>
21 namespace cmis
23 /** Implements a seekable InputStream
24 * working on an std::istream
26 class StdInputStream
27 : public cppu::OWeakObject,
28 public css::io::XInputStream,
29 public css::io::XSeekable
31 public:
33 StdInputStream( boost::shared_ptr< std::istream > const & pStream );
35 virtual ~StdInputStream() override;
37 virtual css::uno::Any SAL_CALL queryInterface ( const css::uno::Type& rType ) override;
39 virtual void SAL_CALL acquire( ) throw ( ) override;
41 virtual void SAL_CALL release( ) throw ( ) override;
43 virtual sal_Int32 SAL_CALL
44 readBytes ( css::uno::Sequence< sal_Int8 >& aData,
45 sal_Int32 nBytesToRead ) override;
47 virtual sal_Int32 SAL_CALL
48 readSomeBytes ( css::uno::Sequence< sal_Int8 >& aData,
49 sal_Int32 nMaxBytesToRead ) override;
51 virtual void SAL_CALL
52 skipBytes ( sal_Int32 nBytesToSkip ) override;
54 virtual sal_Int32 SAL_CALL
55 available ( ) override;
57 virtual void SAL_CALL
58 closeInput ( ) override;
61 /** XSeekable
64 virtual void SAL_CALL
65 seek ( sal_Int64 location ) override;
68 virtual sal_Int64 SAL_CALL
69 getPosition ( ) override;
72 virtual sal_Int64 SAL_CALL
73 getLength ( ) override;
75 private:
77 osl::Mutex m_aMutex;
78 boost::shared_ptr< std::istream > m_pStream;
79 sal_Int64 m_nLength;
84 #endif
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */