LibreOffice Module ucb (master)  1
std_inputstream.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_STD_INPUTSTREAM_HXX
11 #define INCLUDED_UCB_SOURCE_UCP_CMIS_STD_INPUTSTREAM_HXX
12 
13 #include <boost/shared_ptr.hpp>
14 #include <istream>
15 
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>
20 
21 namespace cmis
22 {
27  : public cppu::OWeakObject,
28  public css::io::XInputStream,
29  public css::io::XSeekable
30  {
31  public:
32 
33  StdInputStream( boost::shared_ptr< std::istream > const & pStream );
34 
35  virtual ~StdInputStream() override;
36 
37  virtual css::uno::Any SAL_CALL queryInterface ( const css::uno::Type& rType ) override;
38 
39  virtual void SAL_CALL acquire( ) throw ( ) override;
40 
41  virtual void SAL_CALL release( ) throw ( ) override;
42 
43  virtual sal_Int32 SAL_CALL
44  readBytes ( css::uno::Sequence< sal_Int8 >& aData,
45  sal_Int32 nBytesToRead ) override;
46 
47  virtual sal_Int32 SAL_CALL
48  readSomeBytes ( css::uno::Sequence< sal_Int8 >& aData,
49  sal_Int32 nMaxBytesToRead ) override;
50 
51  virtual void SAL_CALL
52  skipBytes ( sal_Int32 nBytesToSkip ) override;
53 
54  virtual sal_Int32 SAL_CALL
55  available ( ) override;
56 
57  virtual void SAL_CALL
58  closeInput ( ) override;
59 
60 
64  virtual void SAL_CALL
65  seek ( sal_Int64 location ) override;
66 
67 
68  virtual sal_Int64 SAL_CALL
69  getPosition ( ) override;
70 
71 
72  virtual sal_Int64 SAL_CALL
73  getLength ( ) override;
74 
75  private:
76 
77  osl::Mutex m_aMutex;
78  boost::shared_ptr< std::istream > m_pStream;
79  sal_Int64 m_nLength;
80  };
81 
82 }
83 
84 #endif
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual sal_Int64 SAL_CALL getLength() override
const char aData[]
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
Implements a seekable InputStream working on an std::istream.
virtual sal_Int32 SAL_CALL available() override
virtual ~StdInputStream() override
StdInputStream(boost::shared_ptr< std::istream > const &pStream)
virtual void SAL_CALL seek(sal_Int64 location) override
XSeekable.
virtual void SAL_CALL release() override
virtual void SAL_CALL closeInput() override
virtual sal_Int64 SAL_CALL getPosition() override
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL acquire() override
boost::shared_ptr< std::istream > m_pStream