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