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 #pragma once
20 
21 #include <osl/mutex.hxx>
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/io/XSeekable.hpp>
24 #include <com/sun/star/io/XTruncate.hpp>
25 #include <com/sun/star/io/XInputStream.hpp>
26 #include <com/sun/star/io/XOutputStream.hpp>
27 #include <com/sun/star/io/XStream.hpp>
28 #include <com/sun/star/io/XAsyncOutputMonitor.hpp>
29 #include <cppuhelper/implbase.hxx>
30 
31 #include "filrec.hxx"
32 
33 namespace fileaccess {
34 
35  // forward:
36  class TaskManager;
37 
38 class XStream_impl : public cppu::WeakImplHelper<
39  css::io::XStream,
40  css::io::XSeekable,
41  css::io::XInputStream,
42  css::io::XOutputStream,
43  css::io::XTruncate,
44  css::io::XAsyncOutputMonitor >
45  {
46 
47  public:
48 
49  XStream_impl( const OUString& aUncPath, bool bLock );
50 
55  sal_Int32 CtorSuccess() { return m_nErrorCode;}
56  sal_Int32 getMinorError() const { return m_nMinorErrorCode;}
57 
58  virtual ~XStream_impl() override;
59 
60  // XStream
61 
62  virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
63  getInputStream() override;
64 
65  virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL
66  getOutputStream() override;
67 
68 
69  // XTruncate
70 
71  virtual void SAL_CALL truncate() override;
72 
73 
74  // XInputStream
75 
76  sal_Int32 SAL_CALL
77  readBytes(
78  css::uno::Sequence< sal_Int8 >& aData,
79  sal_Int32 nBytesToRead ) override;
80 
81  sal_Int32 SAL_CALL
83  css::uno::Sequence< sal_Int8 >& aData,
84  sal_Int32 nMaxBytesToRead ) override;
85 
86 
87  void SAL_CALL
88  skipBytes( sal_Int32 nBytesToSkip ) override;
89 
90  sal_Int32 SAL_CALL
91  available() override;
92 
93  void SAL_CALL
94  closeInput() override;
95 
96  // XSeekable
97 
98  void SAL_CALL
99  seek( sal_Int64 location ) override;
100 
101  sal_Int64 SAL_CALL
102  getPosition() override;
103 
104  sal_Int64 SAL_CALL
105  getLength() override;
106 
107 
108  // XOutputStream
109 
110  void SAL_CALL
111  writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
112 
113 
114  void SAL_CALL
115  flush() override;
116 
117 
118  void SAL_CALL
119  closeOutput() override;
120 
121  virtual void SAL_CALL waitForCompletion() override;
122 
123  private:
124 
125  osl::Mutex m_aMutex;
127  bool m_nIsOpen;
128 
130 
131  sal_Int32 m_nErrorCode;
132  sal_Int32 m_nMinorErrorCode;
133 
134  // Implementation methods
135 
139  void
140  closeStream();
141 
142  };
143 
144 } // end namespace XStream_impl
145 
146 /* 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:55
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
HierarchyEntryData aData
ReconnectingFile m_aFile
Definition: filstr.hxx:129
sal_Int32 getMinorError() const
Definition: filstr.hxx:56
sal_Int32 m_nMinorErrorCode
Definition: filstr.hxx:132
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