bump product version to 4.1.6.2
[LibreOffice.git] / include / comphelper / oslfile2streamwrap.hxx
blobcdee28870fbabff3d0ea6844ae92bee9dfec6c24
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
20 #define _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
22 #include <osl/mutex.hxx>
23 #include <com/sun/star/io/XOutputStream.hpp>
24 #include <com/sun/star/io/XInputStream.hpp>
25 #include <cppuhelper/implbase1.hxx>
26 #include <osl/file.hxx>
27 #include "comphelper/comphelperdllapi.h"
29 namespace comphelper
31 namespace stario = ::com::sun::star::io;
32 namespace staruno = ::com::sun::star::uno;
34 //==================================================================
35 // FmUnoIOStream,
36 // Stream to read and write data, based on File
37 //==================================================================
38 class COMPHELPER_DLLPUBLIC OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream>
40 ::osl::Mutex m_aMutex;
41 ::osl::File* m_pFile;
43 public:
44 OSLInputStreamWrapper(::osl::File& _rStream);
45 virtual ~OSLInputStreamWrapper();
47 // stario::XInputStream
48 virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
49 virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
50 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
51 virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException);
52 virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException);
55 //==================================================================
56 // FmUnoOutStream,
57 // data sink for the files
58 //==================================================================
59 class OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream>
61 public:
62 COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper(::osl::File& _rFile);
64 private:
65 virtual ~OSLOutputStreamWrapper();
67 // stario::XOutputStream
68 virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
69 virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
70 virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
72 ::osl::File& rFile;
75 } // namespace comphelper
78 #endif // _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */