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 #pragma once
29 
30 #include <config_lgpl.h>
31 #include <sal/types.h>
32 #include <cppuhelper/weak.hxx>
33 #include <com/sun/star/io/XInputStream.hpp>
34 #include <com/sun/star/io/XSeekable.hpp>
35 
36 
37 namespace webdav_ucp
38 {
39 
40 // A simple XInputStream implementation provided specifically for use
41 // by the DAVSession::GET method.
42 class NeonInputStream : public css::io::XInputStream,
43  public css::io::XSeekable,
44  public ::cppu::OWeakObject
45 {
46  private:
47  css::uno::Sequence< sal_Int8 > mInputBuffer;
48  sal_Int64 mLen;
49  sal_Int64 mPos;
50 
51  public:
53  virtual ~NeonInputStream() override;
54 
55  // Add some data to the end of the stream
56  void AddToStream( const char * inBuf, sal_Int32 inLen );
57 
58  // XInterface
59  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & type ) override;
60 
61  virtual void SAL_CALL acquire()
62  noexcept override
63  { OWeakObject::acquire(); }
64 
65  virtual void SAL_CALL release()
66  noexcept override
67  { OWeakObject::release(); }
68 
69 
70  // XInputStream
71  virtual sal_Int32 SAL_CALL readBytes(
72  css::uno::Sequence< sal_Int8 > & aData,
73  sal_Int32 nBytesToRead ) override;
74 
75  virtual sal_Int32 SAL_CALL readSomeBytes(
76  css::uno::Sequence< sal_Int8 > & aData,
77  sal_Int32 nMaxBytesToRead ) override;
78 
79  virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
80 
81  virtual sal_Int32 SAL_CALL available() override;
82 
83  virtual void SAL_CALL closeInput() override;
84 
85  // XSeekable
86  virtual void SAL_CALL seek( sal_Int64 location ) override;
87 
88  virtual sal_Int64 SAL_CALL getPosition() override;
89 
90  virtual sal_Int64 SAL_CALL getLength() override;
91 };
92 
93 } // namespace webdav_ucp
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 void SAL_CALL acquire() noexcept override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &type) override
void AddToStream(const char *inBuf, sal_Int32 inLen)
HierarchyEntryData aData
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) 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 release() noexcept override
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override