Branch libreoffice-5-0-4
[LibreOffice.git] / include / ucbhelper / std_outputstream.hxx
blob126015b7901055b8349593e7b590ef9b979ac909
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_UCBHELPER_STD_OUTPUTSTREAM_HXX
11 #define INCLUDED_UCBHELPER_STD_OUTPUTSTREAM_HXX
13 #include <boost/shared_ptr.hpp>
14 #include <ostream>
16 #include <osl/mutex.hxx>
17 #include <cppuhelper/weak.hxx>
18 #include <cppuhelper/queryinterface.hxx>
19 #include <com/sun/star/io/XOutputStream.hpp>
20 #include <ucbhelper/ucbhelperdllapi.h>
22 namespace ucbhelper
24 /** Implements a OutputStream
25 * working on an std::ostream
27 class UCBHELPER_DLLPUBLIC StdOutputStream :
28 public cppu::OWeakObject,
29 public css::io::XOutputStream
31 public:
33 StdOutputStream( boost::shared_ptr< std::ostream > pStream );
35 virtual ~StdOutputStream( );
37 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType )
38 throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
40 virtual void SAL_CALL acquire ( ) throw ( ) SAL_OVERRIDE;
42 virtual void SAL_CALL release ( ) throw ( ) SAL_OVERRIDE;
44 virtual void SAL_CALL writeBytes ( const css::uno::Sequence< sal_Int8 >& aData )
45 throw ( css::io::NotConnectedException,
46 css::io::BufferSizeExceededException,
47 css::io::IOException,
48 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
50 virtual void SAL_CALL flush ( )
51 throw ( css::io::NotConnectedException,
52 css::io::BufferSizeExceededException,
53 css::io::IOException,
54 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
56 virtual void SAL_CALL closeOutput ( )
57 throw ( css::io::NotConnectedException,
58 css::io::BufferSizeExceededException,
59 css::io::IOException,
60 css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
62 private:
64 osl::Mutex m_aMutex;
65 boost::shared_ptr< std::ostream > m_pStream;
69 #endif
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */