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