1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _GVFSSTREAM_HXX_
20 #define _GVFSSTREAM_HXX_
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <cppuhelper/weak.hxx>
25 #include <com/sun/star/io/XStream.hpp>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XOutputStream.hpp>
28 #include <com/sun/star/io/XTruncate.hpp>
29 #include <com/sun/star/io/XSeekable.hpp>
31 #include <libgnomevfs/gnome-vfs-handle.h>
36 class Stream
: public ::com::sun::star::io::XStream
,
37 public ::com::sun::star::io::XInputStream
,
38 public ::com::sun::star::io::XOutputStream
,
39 public ::com::sun::star::io::XTruncate
,
40 public ::com::sun::star::io::XSeekable
,
41 public ::cppu::OWeakObject
44 GnomeVFSHandle
*m_handle
;
45 GnomeVFSFileInfo m_info
;
48 sal_Bool m_bInputStreamCalled
;
49 sal_Bool m_bOutputStreamCalled
;
51 void throwOnError( GnomeVFSResult result
)
52 throw( ::com::sun::star::io::NotConnectedException
,
53 ::com::sun::star::io::BufferSizeExceededException
,
54 ::com::sun::star::io::IOException
,
55 ::com::sun::star::uno::RuntimeException
);
57 void closeStream( void )
58 throw( ::com::sun::star::io::NotConnectedException
,
59 ::com::sun::star::io::IOException
,
60 ::com::sun::star::uno::RuntimeException
);
63 Stream ( GnomeVFSHandle
*handle
,
64 const GnomeVFSFileInfo
*aInfo
);
68 virtual com::sun::star::uno::Any SAL_CALL
queryInterface(const ::com::sun::star::uno::Type
& type
)
69 throw( ::com::sun::star::uno::RuntimeException
);
70 virtual void SAL_CALL
acquire( void )
72 { OWeakObject::acquire(); }
73 virtual void SAL_CALL
release( void )
75 { OWeakObject::release(); }
78 virtual com::sun::star::uno::Reference
< com::sun::star::io::XInputStream
> SAL_CALL
getInputStream( )
79 throw( com::sun::star::uno::RuntimeException
);
81 virtual com::sun::star::uno::Reference
< com::sun::star::io::XOutputStream
> SAL_CALL
getOutputStream( )
82 throw( com::sun::star::uno::RuntimeException
);
85 virtual sal_Int32 SAL_CALL
readBytes(
86 ::com::sun::star::uno::Sequence
< sal_Int8
> & aData
,
87 sal_Int32 nBytesToRead
)
88 throw( ::com::sun::star::io::NotConnectedException
,
89 ::com::sun::star::io::BufferSizeExceededException
,
90 ::com::sun::star::io::IOException
,
91 ::com::sun::star::uno::RuntimeException
);
93 virtual sal_Int32 SAL_CALL
readSomeBytes(
94 ::com::sun::star::uno::Sequence
< sal_Int8
> & aData
,
95 sal_Int32 nMaxBytesToRead
)
96 throw( ::com::sun::star::io::NotConnectedException
,
97 ::com::sun::star::io::BufferSizeExceededException
,
98 ::com::sun::star::io::IOException
,
99 ::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
skipBytes( sal_Int32 nBytesToSkip
)
102 throw( ::com::sun::star::io::NotConnectedException
,
103 ::com::sun::star::io::BufferSizeExceededException
,
104 ::com::sun::star::io::IOException
,
105 ::com::sun::star::uno::RuntimeException
);
107 virtual sal_Int32 SAL_CALL
available( void )
108 throw( ::com::sun::star::io::NotConnectedException
,
109 ::com::sun::star::io::IOException
,
110 ::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
closeInput( void )
113 throw( ::com::sun::star::io::NotConnectedException
,
114 ::com::sun::star::io::IOException
,
115 ::com::sun::star::uno::RuntimeException
);
118 virtual void SAL_CALL
seek( sal_Int64 location
)
119 throw( ::com::sun::star::lang::IllegalArgumentException
,
120 ::com::sun::star::io::IOException
,
121 ::com::sun::star::uno::RuntimeException
);
123 virtual sal_Int64 SAL_CALL
getPosition()
124 throw( ::com::sun::star::io::IOException
,
125 ::com::sun::star::uno::RuntimeException
);
127 virtual sal_Int64 SAL_CALL
getLength()
128 throw( ::com::sun::star::io::IOException
,
129 ::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
writeBytes( const com::sun::star::uno::Sequence
< sal_Int8
>& aData
)
133 throw( com::sun::star::io::NotConnectedException
,
134 com::sun::star::io::BufferSizeExceededException
,
135 com::sun::star::io::IOException
,
136 com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
flush( void )
139 throw( com::sun::star::io::NotConnectedException
,
140 com::sun::star::io::BufferSizeExceededException
,
141 com::sun::star::io::IOException
,
142 com::sun::star::uno::RuntimeException
);
145 virtual void SAL_CALL
closeOutput( void )
146 throw( com::sun::star::io::NotConnectedException
,
147 com::sun::star::io::IOException
,
148 com::sun::star::uno::RuntimeException
);
151 virtual void SAL_CALL
truncate( void )
152 throw( com::sun::star::io::IOException
,
153 com::sun::star::uno::RuntimeException
);
157 #endif // _GVFSSTREAM_HXX_
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */