bump product version to 5.0.4.1
[LibreOffice.git] / xmlhelp / source / cxxhelp / provider / bufferedinputstream.hxx
blob80f4128738aedbfe0832a5feab7a8330355bbbb6
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 .
20 #ifndef INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_BUFFEREDINPUTSTREAM_HXX
21 #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_BUFFEREDINPUTSTREAM_HXX
23 #include <cppuhelper/weak.hxx>
24 #include <osl/mutex.hxx>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/io/XSeekable.hpp>
29 namespace chelp {
31 class BufferedInputStream
32 : public cppu::OWeakObject,
33 public com::sun::star::io::XInputStream,
34 public com::sun::star::io::XSeekable
36 private:
38 sal_Int32 m_nBufferLocation;
39 sal_Int32 m_nBufferSize;
40 sal_Int8 *m_pBuffer;
41 osl::Mutex m_aMutex;
43 public:
45 BufferedInputStream(
46 const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream);
48 virtual ~BufferedInputStream();
50 virtual com::sun::star::uno::Any SAL_CALL
51 queryInterface( const com::sun::star::uno::Type& rType )
52 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
54 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
56 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
59 virtual sal_Int32 SAL_CALL readBytes( com::sun::star::uno::Sequence< sal_Int8 >& aData,
60 sal_Int32 nBytesToRead )
61 throw( com::sun::star::io::NotConnectedException,
62 com::sun::star::io::BufferSizeExceededException,
63 com::sun::star::io::IOException,
64 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
66 virtual sal_Int32 SAL_CALL readSomeBytes( com::sun::star::uno::Sequence< sal_Int8 >& aData,
67 sal_Int32 nMaxBytesToRead )
68 throw( com::sun::star::io::NotConnectedException,
69 com::sun::star::io::BufferSizeExceededException,
70 com::sun::star::io::IOException,
71 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
73 virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
74 throw( com::sun::star::io::NotConnectedException,
75 com::sun::star::io::BufferSizeExceededException,
76 com::sun::star::io::IOException,
77 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 virtual sal_Int32 SAL_CALL available()
80 throw( com::sun::star::io::NotConnectedException,
81 com::sun::star::io::IOException,
82 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
84 virtual void SAL_CALL closeInput()
85 throw( com::sun::star::io::NotConnectedException,
86 com::sun::star::io::IOException,
87 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
89 virtual void SAL_CALL seek( sal_Int64 location )
90 throw( com::sun::star::lang::IllegalArgumentException,
91 com::sun::star::io::IOException,
92 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
94 virtual sal_Int64 SAL_CALL getPosition()
95 throw( com::sun::star::io::IOException,
96 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
98 virtual sal_Int64 SAL_CALL getLength()
99 throw( com::sun::star::io::IOException,
100 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 extern com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
105 turnToSeekable(
106 const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream);
110 #endif // INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_BUFFEREDINPUTSTREAM_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */