LibreOffice Module ucb (master)  1
NeonInputStream.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONINPUTSTREAM_HXX
29 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONINPUTSTREAM_HXX
30 
31 #include <config_lgpl.h>
32 #include <sal/types.h>
33 #include <cppuhelper/weak.hxx>
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XSeekable.hpp>
36 
37 
38 namespace webdav_ucp
39 {
40 
41 // A simple XInputStream implementation provided specifically for use
42 // by the DAVSession::GET method.
43 class NeonInputStream : public css::io::XInputStream,
44  public css::io::XSeekable,
45  public ::cppu::OWeakObject
46 {
47  private:
48  css::uno::Sequence< sal_Int8 > mInputBuffer;
49  sal_Int64 mLen;
50  sal_Int64 mPos;
51 
52  public:
54  virtual ~NeonInputStream() override;
55 
56  // Add some data to the end of the stream
57  void AddToStream( const char * inBuf, sal_Int32 inLen );
58 
59  // XInterface
60  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & type ) override;
61 
62  virtual void SAL_CALL acquire()
63  throw () override
64  { OWeakObject::acquire(); }
65 
66  virtual void SAL_CALL release()
67  throw() override
68  { OWeakObject::release(); }
69 
70 
71  // XInputStream
72  virtual sal_Int32 SAL_CALL readBytes(
73  css::uno::Sequence< sal_Int8 > & aData,
74  sal_Int32 nBytesToRead ) override;
75 
76  virtual sal_Int32 SAL_CALL readSomeBytes(
77  css::uno::Sequence< sal_Int8 > & aData,
78  sal_Int32 nMaxBytesToRead ) override;
79 
80  virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
81 
82  virtual sal_Int32 SAL_CALL available() override;
83 
84  virtual void SAL_CALL closeInput() override;
85 
86  // XSeekable
87  virtual void SAL_CALL seek( sal_Int64 location ) override;
88 
89  virtual sal_Int64 SAL_CALL getPosition() override;
90 
91  virtual sal_Int64 SAL_CALL getLength() override;
92 };
93 
94 } // namespace webdav_ucp
95 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONINPUTSTREAM_HXX
96 
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL release() override
virtual sal_Int32 SAL_CALL available() override
css::uno::Sequence< sal_Int8 > mInputBuffer
virtual sal_Int64 SAL_CALL getLength() override
virtual void SAL_CALL closeInput() override
virtual ~NeonInputStream() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &type) override
void AddToStream(const char *inBuf, sal_Int32 inLen)
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
virtual void SAL_CALL acquire() override
virtual void SAL_CALL seek(sal_Int64 location) override
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual sal_Int64 SAL_CALL getPosition() override
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override