Line data Source code
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 <rtl/ustring.hxx>
34 : #include <cppuhelper/weak.hxx>
35 : #include <com/sun/star/io/XInputStream.hpp>
36 : #include <com/sun/star/io/XSeekable.hpp>
37 :
38 :
39 : namespace webdav_ucp
40 : {
41 :
42 : // A simple XInputStream implementation provided specifically for use
43 : // by the DAVSession::GET method.
44 : class NeonInputStream : public ::com::sun::star::io::XInputStream,
45 : public ::com::sun::star::io::XSeekable,
46 : public ::cppu::OWeakObject
47 : {
48 : private:
49 : com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer;
50 : sal_Int64 mLen;
51 : sal_Int64 mPos;
52 :
53 : public:
54 : NeonInputStream( void );
55 : virtual ~NeonInputStream();
56 :
57 : // Add some data to the end of the stream
58 : void AddToStream( const char * inBuf, sal_Int32 inLen );
59 :
60 : // XInterface
61 : virtual com::sun::star::uno::Any SAL_CALL queryInterface(
62 : const ::com::sun::star::uno::Type & type )
63 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
64 :
65 0 : virtual void SAL_CALL acquire( void )
66 : throw () SAL_OVERRIDE
67 0 : { OWeakObject::acquire(); }
68 :
69 0 : virtual void SAL_CALL release( void )
70 : throw() SAL_OVERRIDE
71 0 : { OWeakObject::release(); }
72 :
73 :
74 : // XInputStream
75 : virtual sal_Int32 SAL_CALL readBytes(
76 : ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
77 : sal_Int32 nBytesToRead )
78 : throw( ::com::sun::star::io::NotConnectedException,
79 : ::com::sun::star::io::BufferSizeExceededException,
80 : ::com::sun::star::io::IOException,
81 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 :
83 : virtual sal_Int32 SAL_CALL readSomeBytes(
84 : ::com::sun::star::uno::Sequence< sal_Int8 > & aData,
85 : sal_Int32 nMaxBytesToRead )
86 : throw( ::com::sun::star::io::NotConnectedException,
87 : ::com::sun::star::io::BufferSizeExceededException,
88 : ::com::sun::star::io::IOException,
89 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
90 :
91 : virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
92 : throw( ::com::sun::star::io::NotConnectedException,
93 : ::com::sun::star::io::BufferSizeExceededException,
94 : ::com::sun::star::io::IOException,
95 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
96 :
97 : virtual sal_Int32 SAL_CALL available( void )
98 : throw( ::com::sun::star::io::NotConnectedException,
99 : ::com::sun::star::io::IOException,
100 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
101 :
102 : virtual void SAL_CALL closeInput( void )
103 : throw( ::com::sun::star::io::NotConnectedException,
104 : ::com::sun::star::io::IOException,
105 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
106 :
107 : // XSeekable
108 : virtual void SAL_CALL seek( sal_Int64 location )
109 : throw( ::com::sun::star::lang::IllegalArgumentException,
110 : ::com::sun::star::io::IOException,
111 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
112 :
113 : virtual sal_Int64 SAL_CALL getPosition()
114 : throw( ::com::sun::star::io::IOException,
115 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
116 :
117 : virtual sal_Int64 SAL_CALL getLength()
118 : throw( ::com::sun::star::io::IOException,
119 : ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
120 : };
121 :
122 : } // namespace webdav_ucp
123 : #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_NEONINPUTSTREAM_HXX
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|