LibreOffice Module ucb (master)  1
SerfInputStream.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  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
22 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
23 
24 #include <sal/types.h>
25 #include <cppuhelper/weak.hxx>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XSeekable.hpp>
28 
29 
30 namespace http_dav_ucp
31 {
32 
33 
34 // SerfInputStream
35 // A simple XInputStream implementation provided specifically for use
36 // by the DAVSession::GET method.
37 
38 class SerfInputStream : public css::io::XInputStream,
39  public css::io::XSeekable,
40  public ::cppu::OWeakObject
41 {
42  private:
43  css::uno::Sequence< sal_Int8 > mInputBuffer;
44  sal_Int64 mLen;
45  sal_Int64 mPos;
46 
47  public:
49  virtual ~SerfInputStream() override;
50 
51  // Add some data to the end of the stream
52  void AddToStream( const char * inBuf, sal_Int32 inLen );
53 
54  // XInterface
55  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & type ) override;
56 
57  virtual void SAL_CALL acquire()
58  throw () override
59  { OWeakObject::acquire(); }
60 
61  virtual void SAL_CALL release()
62  throw() override
63  { OWeakObject::release(); }
64 
65 
66  // XInputStream
67  virtual sal_Int32 SAL_CALL readBytes(
68  css::uno::Sequence< sal_Int8 > & aData,
69  sal_Int32 nBytesToRead ) override;
70 
71  virtual sal_Int32 SAL_CALL readSomeBytes(
72  css::uno::Sequence< sal_Int8 > & aData,
73  sal_Int32 nMaxBytesToRead ) override;
74 
75  virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override;
76 
77  virtual sal_Int32 SAL_CALL available() override;
78 
79  virtual void SAL_CALL closeInput() override;
80 
81  // XSeekable
82  virtual void SAL_CALL seek( sal_Int64 location ) override;
83 
84  virtual sal_Int64 SAL_CALL getPosition() override;
85 
86  virtual sal_Int64 SAL_CALL getLength() override;
87 };
88 
89 } // namespace http_dav_ucp
90 
91 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFINPUTSTREAM_HXX
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
virtual void SAL_CALL release() override
virtual sal_Int64 SAL_CALL getLength() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &type) override
virtual sal_Int64 SAL_CALL getPosition() override
virtual void SAL_CALL seek(sal_Int64 location) override
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
css::uno::Sequence< sal_Int8 > mInputBuffer
virtual ~SerfInputStream() override
virtual sal_Int32 SAL_CALL available() override
virtual void SAL_CALL closeInput() override
void AddToStream(const char *inBuf, sal_Int32 inLen)
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual void SAL_CALL acquire() override