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/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/implbase.hxx>
33 
34 #include "filrec.hxx"
35 
36 namespace fileaccess {
37 
38  // forward:
39  class TaskManager;
40 
41 class XStream_impl : public cppu::WeakImplHelper<
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( const OUString& aUncPath, bool bLock );
53 
58  sal_Int32 CtorSuccess() { return m_nErrorCode;}
59  sal_Int32 getMinorError() { return m_nMinorErrorCode;}
60 
61  virtual ~XStream_impl() override;
62 
63  // XStream
64 
65  virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
66  getInputStream() override;
67 
68  virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL
69  getOutputStream() override;
70 
71 
72  // XTruncate
73 
74  virtual void SAL_CALL truncate() override;
75 
76 
77  // XInputStream
78 
79  sal_Int32 SAL_CALL
80  readBytes(
81  css::uno::Sequence< sal_Int8 >& aData,
82  sal_Int32 nBytesToRead ) override;
83 
84  sal_Int32 SAL_CALL
86  css::uno::Sequence< sal_Int8 >& aData,
87  sal_Int32 nMaxBytesToRead ) override;
88 
89 
90  void SAL_CALL
91  skipBytes( sal_Int32 nBytesToSkip ) override;
92 
93  sal_Int32 SAL_CALL
94  available() override;
95 
96  void SAL_CALL
97  closeInput() override;
98 
99  // XSeekable
100 
101  void SAL_CALL
102  seek( sal_Int64 location ) override;
103 
104  sal_Int64 SAL_CALL
105  getPosition() override;
106 
107  sal_Int64 SAL_CALL
108  getLength() override;
109 
110 
111  // XOutputStream
112 
113  void SAL_CALL
114  writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
115 
116 
117  void SAL_CALL
118  flush() override;
119 
120 
121  void SAL_CALL
122  closeOutput() override;
123 
124  virtual void SAL_CALL waitForCompletion() override;
125 
126  private:
127 
128  osl::Mutex m_aMutex;
130  bool m_nIsOpen;
131 
133 
134  sal_Int32 m_nErrorCode;
135  sal_Int32 m_nMinorErrorCode;
136 
137  // Implementation methods
138 
142  void
143  closeStream();
144 
145  };
146 
147 } // end namespace XStream_impl
148 
149 #endif
150 
151 /* 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:156
sal_Int32 SAL_CALL available() override
Definition: filstr.cxx:172
virtual void SAL_CALL waitForCompletion() override
Definition: filstr.cxx:265
sal_Int32 getMinorError()
Definition: filstr.hxx:59
void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
Definition: filstr.cxx:165
void SAL_CALL closeOutput() override
Definition: filstr.cxx:223
void SAL_CALL seek(sal_Int64 location) override
Definition: filstr.cxx:234
sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
Definition: filstr.cxx:126
void SAL_CALL closeInput() override
Definition: filstr.cxx:212
sal_Int32 CtorSuccess()
Returns an error code as given by filerror.hxx.
Definition: filstr.hxx:58
void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
Definition: filstr.cxx:180
sal_Int64 SAL_CALL getLength() override
Definition: filstr.cxx:253
void SAL_CALL flush() override
Definition: filstr.cxx:262
virtual void SAL_CALL truncate() override
Definition: filstr.cxx:112
sal_Int64 SAL_CALL getPosition() override
Definition: filstr.cxx:244
ReconnectingFile m_aFile
Definition: filstr.hxx:132
sal_Int32 m_nMinorErrorCode
Definition: filstr.hxx:135
virtual ~XStream_impl() override
Definition: filstr.cxx:73
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
Definition: filstr.cxx:102
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
Definition: filstr.cxx:91
XStream_impl(const OUString &aUncPath, bool bLock)
Definition: filstr.cxx:48