LibreOffice Module ucb (master)  1
filstr.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 #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/io/XSeekable.hpp>
25 #include <com/sun/star/io/XTruncate.hpp>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XOutputStream.hpp>
28 #include <com/sun/star/io/XStream.hpp>
29 #include <com/sun/star/io/XAsyncOutputMonitor.hpp>
30 #include <cppuhelper/implbase.hxx>
31 
32 #include "filrec.hxx"
33 
34 namespace fileaccess {
35 
36  // forward:
37  class TaskManager;
38 
39 class XStream_impl : public cppu::WeakImplHelper<
40  css::io::XStream,
41  css::io::XSeekable,
42  css::io::XInputStream,
43  css::io::XOutputStream,
44  css::io::XTruncate,
45  css::io::XAsyncOutputMonitor >
46  {
47 
48  public:
49 
50  XStream_impl( const OUString& aUncPath, bool bLock );
51 
56  sal_Int32 CtorSuccess() { return m_nErrorCode;}
57  sal_Int32 getMinorError() const { return m_nMinorErrorCode;}
58 
59  virtual ~XStream_impl() override;
60 
61  // XStream
62 
63  virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
64  getInputStream() override;
65 
66  virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL
67  getOutputStream() override;
68 
69 
70  // XTruncate
71 
72  virtual void SAL_CALL truncate() override;
73 
74 
75  // XInputStream
76 
77  sal_Int32 SAL_CALL
78  readBytes(
79  css::uno::Sequence< sal_Int8 >& aData,
80  sal_Int32 nBytesToRead ) override;
81 
82  sal_Int32 SAL_CALL
84  css::uno::Sequence< sal_Int8 >& aData,
85  sal_Int32 nMaxBytesToRead ) override;
86 
87 
88  void SAL_CALL
89  skipBytes( sal_Int32 nBytesToSkip ) override;
90 
91  sal_Int32 SAL_CALL
92  available() override;
93 
94  void SAL_CALL
95  closeInput() override;
96 
97  // XSeekable
98 
99  void SAL_CALL
100  seek( sal_Int64 location ) override;
101 
102  sal_Int64 SAL_CALL
103  getPosition() override;
104 
105  sal_Int64 SAL_CALL
106  getLength() override;
107 
108 
109  // XOutputStream
110 
111  void SAL_CALL
112  writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
113 
114 
115  void SAL_CALL
116  flush() override;
117 
118 
119  void SAL_CALL
120  closeOutput() override;
121 
122  virtual void SAL_CALL waitForCompletion() override;
123 
124  private:
125 
126  osl::Mutex m_aMutex;
128  bool m_nIsOpen;
129 
131 
132  sal_Int32 m_nErrorCode;
133  sal_Int32 m_nMinorErrorCode;
134 
135  // Implementation methods
136 
140  void
141  closeStream();
142 
143  };
144 
145 } // end namespace XStream_impl
146 
147 #endif
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
Definition: filstr.cxx:153
sal_Int32 SAL_CALL available() override
Definition: filstr.cxx:169
virtual void SAL_CALL waitForCompletion() override
Definition: filstr.cxx:262
void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
Definition: filstr.cxx:162
void SAL_CALL closeOutput() override
Definition: filstr.cxx:220
void SAL_CALL seek(sal_Int64 location) override
Definition: filstr.cxx:231
sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
Definition: filstr.cxx:123
void SAL_CALL closeInput() override
Definition: filstr.cxx:209
sal_Int32 CtorSuccess()
Returns an error code as given by filerror.hxx.
Definition: filstr.hxx:56
void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
Definition: filstr.cxx:177
sal_Int64 SAL_CALL getLength() override
Definition: filstr.cxx:250
void SAL_CALL flush() override
Definition: filstr.cxx:259
virtual void SAL_CALL truncate() override
Definition: filstr.cxx:109
sal_Int64 SAL_CALL getPosition() override
Definition: filstr.cxx:241
ReconnectingFile m_aFile
Definition: filstr.hxx:130
sal_Int32 getMinorError() const
Definition: filstr.hxx:57
sal_Int32 m_nMinorErrorCode
Definition: filstr.hxx:133
virtual ~XStream_impl() override
Definition: filstr.cxx:70
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
Definition: filstr.cxx:99
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
Definition: filstr.cxx:88
XStream_impl(const OUString &aUncPath, bool bLock)
Definition: filstr.cxx:45