Line data Source code
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 : #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_FILSTR_HXX
20 : #define INCLUDED_UCB_SOURCE_UCP_FILE_FILSTR_HXX
21 :
22 : #include <osl/mutex.hxx>
23 : #include <rtl/ustring.hxx>
24 : #include <com/sun/star/uno/XInterface.hpp>
25 : #include <com/sun/star/io/XSeekable.hpp>
26 : #include <com/sun/star/io/XTruncate.hpp>
27 : #include <com/sun/star/io/XInputStream.hpp>
28 : #include <com/sun/star/io/XOutputStream.hpp>
29 : #include <com/sun/star/io/XStream.hpp>
30 : #include "com/sun/star/io/XAsyncOutputMonitor.hpp"
31 : #include <com/sun/star/ucb/XContentProvider.hpp>
32 : #include <cppuhelper/implbase6.hxx>
33 :
34 : #include "filrec.hxx"
35 :
36 : namespace fileaccess {
37 :
38 : // forward:
39 : class shell;
40 :
41 : class XStream_impl : public cppu::WeakImplHelper6<
42 : css::io::XStream,
43 : css::io::XSeekable,
44 : css::io::XInputStream,
45 : css::io::XOutputStream,
46 : css::io::XTruncate,
47 : css::io::XAsyncOutputMonitor >
48 : {
49 :
50 : public:
51 :
52 : XStream_impl( shell* pMyShell,const OUString& aUncPath, bool bLock );
53 :
54 : /**
55 : * Returns an error code as given by filerror.hxx
56 : */
57 :
58 23980 : sal_Int32 SAL_CALL CtorSuccess() { return m_nErrorCode;}
59 133 : sal_Int32 SAL_CALL getMinorError() { return m_nMinorErrorCode;}
60 :
61 : virtual ~XStream_impl();
62 :
63 : // XStream
64 :
65 : virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL
66 : getInputStream( )
67 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
68 :
69 : virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
70 : getOutputStream( )
71 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
72 :
73 :
74 : // XTruncate
75 :
76 : virtual void SAL_CALL truncate()
77 : throw( com::sun::star::io::IOException,
78 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 :
80 :
81 : // XInputStream
82 :
83 : sal_Int32 SAL_CALL
84 : readBytes(
85 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
86 : sal_Int32 nBytesToRead )
87 : throw( com::sun::star::io::NotConnectedException,
88 : com::sun::star::io::BufferSizeExceededException,
89 : com::sun::star::io::IOException,
90 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 :
92 : sal_Int32 SAL_CALL
93 : 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, std::exception) SAL_OVERRIDE;
100 :
101 :
102 : void SAL_CALL
103 : skipBytes(
104 : sal_Int32 nBytesToSkip )
105 : throw( com::sun::star::io::NotConnectedException,
106 : com::sun::star::io::BufferSizeExceededException,
107 : com::sun::star::io::IOException,
108 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
109 :
110 : sal_Int32 SAL_CALL
111 : available(
112 : void )
113 : throw( com::sun::star::io::NotConnectedException,
114 : com::sun::star::io::IOException,
115 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
116 :
117 : void SAL_CALL
118 : closeInput(
119 : void )
120 : throw( com::sun::star::io::NotConnectedException,
121 : com::sun::star::io::IOException,
122 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
123 :
124 : // XSeekable
125 :
126 : void SAL_CALL
127 : seek(
128 : sal_Int64 location )
129 : throw( com::sun::star::lang::IllegalArgumentException,
130 : com::sun::star::io::IOException,
131 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
132 :
133 : sal_Int64 SAL_CALL
134 : getPosition(
135 : void )
136 : throw( com::sun::star::io::IOException,
137 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
138 :
139 : sal_Int64 SAL_CALL
140 : getLength(
141 : void )
142 : throw( com::sun::star::io::IOException,
143 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
144 :
145 :
146 : // XOutputStream
147 :
148 : void SAL_CALL
149 : writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
150 : throw( com::sun::star::io::NotConnectedException,
151 : com::sun::star::io::BufferSizeExceededException,
152 : com::sun::star::io::IOException,
153 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 :
155 :
156 :
157 : void SAL_CALL
158 : flush()
159 : throw( com::sun::star::io::NotConnectedException,
160 : com::sun::star::io::BufferSizeExceededException,
161 : com::sun::star::io::IOException,
162 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 :
164 :
165 : void SAL_CALL
166 : closeOutput(
167 : void )
168 : throw( com::sun::star::io::NotConnectedException,
169 : com::sun::star::io::IOException,
170 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
171 :
172 : virtual void SAL_CALL waitForCompletion()
173 : throw (
174 : com::sun::star::io::IOException,
175 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 :
177 : private:
178 :
179 : osl::Mutex m_aMutex;
180 : bool m_bInputStreamCalled,m_bOutputStreamCalled;
181 :
182 : shell* m_pMyShell;
183 : com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > m_xProvider;
184 : bool m_nIsOpen;
185 :
186 : ReconnectingFile m_aFile;
187 :
188 : sal_Int32 m_nErrorCode;
189 : sal_Int32 m_nMinorErrorCode;
190 :
191 : // Implementation methods
192 :
193 : void SAL_CALL
194 : closeStream(
195 : void )
196 : throw( com::sun::star::io::NotConnectedException,
197 : com::sun::star::io::IOException,
198 : com::sun::star::uno::RuntimeException );
199 :
200 : };
201 :
202 : } // end namespace XStream_impl
203 :
204 : #endif
205 :
206 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|