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#pragma once
11
12#include <boost/shared_ptr.hpp>
13#include <istream>
14
15#include <mutex>
16#include <cppuhelper/weak.hxx>
17#include <com/sun/star/io/XInputStream.hpp>
18#include <com/sun/star/io/XSeekable.hpp>
19
20namespace cmis
21{
26 : public cppu::OWeakObject,
27 public css::io::XInputStream,
28 public css::io::XSeekable
29 {
30 public:
31
32 StdInputStream( boost::shared_ptr< std::istream > pStream );
33
34 virtual ~StdInputStream() override;
35
36 virtual css::uno::Any SAL_CALL queryInterface ( const css::uno::Type& rType ) override;
37
38 virtual void SAL_CALL acquire( ) noexcept override;
39
40 virtual void SAL_CALL release( ) noexcept override;
41
42 virtual sal_Int32 SAL_CALL
43 readBytes ( css::uno::Sequence< sal_Int8 >& aData,
44 sal_Int32 nBytesToRead ) override;
45
46 virtual sal_Int32 SAL_CALL
47 readSomeBytes ( css::uno::Sequence< sal_Int8 >& aData,
48 sal_Int32 nMaxBytesToRead ) override;
49
50 virtual void SAL_CALL
51 skipBytes ( sal_Int32 nBytesToSkip ) override;
52
53 virtual sal_Int32 SAL_CALL
54 available ( ) override;
55
56 virtual void SAL_CALL
57 closeInput ( ) override;
58
59
63 virtual void SAL_CALL
64 seek ( sal_Int64 location ) override;
65
66
67 virtual sal_Int64 SAL_CALL
68 getPosition ( ) override;
69
70
71 virtual sal_Int64 SAL_CALL
72 getLength ( ) override;
73
74 private:
75
76 std::mutex m_aMutex;
77 boost::shared_ptr< std::istream > m_pStream;
78 sal_Int64 m_nLength;
79 };
80
81}
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implements a seekable InputStream working on an std::istream.
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
virtual sal_Int64 SAL_CALL getPosition() override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
boost::shared_ptr< std::istream > m_pStream
virtual sal_Int64 SAL_CALL getLength() override
virtual ~StdInputStream() override
virtual void SAL_CALL closeInput() override
StdInputStream(boost::shared_ptr< std::istream > pStream)
virtual sal_Int32 SAL_CALL available() override
virtual void SAL_CALL seek(sal_Int64 location) override
XSeekable.
constexpr OUStringLiteral aData