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 <rtl/ustring.hxx>
22#include <com/sun/star/io/XSeekable.hpp>
23#include <com/sun/star/io/XTruncate.hpp>
24#include <com/sun/star/io/XInputStream.hpp>
25#include <com/sun/star/io/XOutputStream.hpp>
26#include <com/sun/star/io/XStream.hpp>
27#include <com/sun/star/io/XAsyncOutputMonitor.hpp>
28#include <com/sun/star/lang/XUnoTunnel.hpp>
31#include <mutex>
32
33#include "filrec.hxx"
34
35namespace fileaccess {
36
37 // forward:
38 class TaskManager;
39
40class XStream_impl : public cppu::WeakImplHelper<
41 css::io::XStream,
42 css::io::XSeekable,
43 css::io::XInputStream,
44 css::io::XOutputStream,
45 css::io::XTruncate,
46 css::io::XAsyncOutputMonitor,
47 css::lang::XUnoTunnel >,
49 {
50
51 public:
52
53 XStream_impl( const OUString& aUncPath, bool bLock );
54
59 sal_Int32 CtorSuccess() const { return m_nErrorCode;}
60 sal_Int32 getMinorError() const { return m_nMinorErrorCode;}
61
62 virtual ~XStream_impl() override;
63
64 // XStream
65
66 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
67 getInputStream() override;
68
69 virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL
70 getOutputStream() override;
71
72
73 // XTruncate
74
75 virtual void SAL_CALL truncate() override;
76
77
78 // XInputStream
79
80 sal_Int32 SAL_CALL
82 css::uno::Sequence< sal_Int8 >& aData,
83 sal_Int32 nBytesToRead ) override;
84
85 sal_Int32 SAL_CALL
87 css::uno::Sequence< sal_Int8 >& aData,
88 sal_Int32 nMaxBytesToRead ) override;
89
90
91 void SAL_CALL
92 skipBytes( sal_Int32 nBytesToSkip ) override;
93
94 sal_Int32 SAL_CALL
95 available() override;
96
97 void SAL_CALL
98 closeInput() override;
99
100 // XSeekable
101
102 void SAL_CALL
103 seek( sal_Int64 location ) override;
104
105 sal_Int64 SAL_CALL
106 getPosition() override;
107
108 sal_Int64 SAL_CALL
109 getLength() override;
110
111
112 // XOutputStream
113
114 void SAL_CALL
115 writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override;
116
117
118 void SAL_CALL
119 flush() override;
120
121
122 void SAL_CALL
123 closeOutput() override;
124
125 virtual void SAL_CALL waitForCompletion() override;
126
127 // XUnoTunnel
128 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
129
130 // utl::ByteReader
131 virtual sal_Int32
133 sal_Int8* aData,
134 sal_Int32 nMaxBytesToRead ) override;
135
136 private:
137
138 std::mutex m_aMutex;
141
143
144 sal_Int32 m_nErrorCode;
146
147 // Implementation methods
148
152 void
153 closeStream();
154
155 };
156
157} // end namespace XStream_impl
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &_rIdentifier) override
Definition: filstr.cxx:168
void SAL_CALL closeInput() override
Definition: filstr.cxx:232
virtual ~XStream_impl() override
Definition: filstr.cxx:70
sal_Int64 SAL_CALL getLength() override
Definition: filstr.cxx:273
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
Definition: filstr.cxx:88
void SAL_CALL seek(sal_Int64 location) override
Definition: filstr.cxx:254
void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
Definition: filstr.cxx:200
sal_Int32 m_nMinorErrorCode
Definition: filstr.hxx:145
void SAL_CALL flush() override
Definition: filstr.cxx:282
sal_Int64 SAL_CALL getPosition() override
Definition: filstr.cxx:264
sal_Int32 CtorSuccess() const
Returns an error code as given by filerror.hxx.
Definition: filstr.hxx:59
sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
Definition: filstr.cxx:123
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
Definition: filstr.cxx:99
void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
Definition: filstr.cxx:185
void SAL_CALL closeOutput() override
Definition: filstr.cxx:243
sal_Int32 SAL_CALL available() override
Definition: filstr.cxx:192
sal_Int32 getMinorError() const
Definition: filstr.hxx:60
XStream_impl(const OUString &aUncPath, bool bLock)
Definition: filstr.cxx:45
sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual void SAL_CALL waitForCompletion() override
Definition: filstr.cxx:285
virtual void SAL_CALL truncate() override
Definition: filstr.cxx:109
ReconnectingFile m_aFile
Definition: filstr.hxx:142
signed char sal_Int8