1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_COMPHELPER_STREAMSECTION_HXX
21 #define INCLUDED_COMPHELPER_STREAMSECTION_HXX
23 #include <config_options.h>
24 #include <com/sun/star/uno/Reference.h>
25 #include <comphelper/comphelperdllapi.h>
27 namespace com::sun::star::io
29 class XDataInputStream
;
31 namespace com::sun::star::io
33 class XDataOutputStream
;
35 namespace com::sun::star::io
37 class XMarkableStream
;
42 /** implements handling for compatibly reading/writing data from/into an input/output stream.
43 data written in a block secured by this class should be readable by older versions which
44 use the same mechanism.
47 class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC
) OStreamSection
49 css::uno::Reference
<css::io::XMarkableStream
> m_xMarkStream
;
50 css::uno::Reference
<css::io::XDataInputStream
> m_xInStream
;
51 css::uno::Reference
<css::io::XDataOutputStream
> m_xOutStream
;
53 sal_Int32 m_nBlockStart
;
54 sal_Int32 m_nBlockLen
;
57 /** starts reading of a "skippable" section of data within the given input stream<BR>
58 @param _rxInput the stream to read from. Must support the
59 css::io::XMarkableStream interface
61 OStreamSection(const css::uno::Reference
<css::io::XDataInputStream
>& _rxInput
);
63 /** starts writing of a "skippable" section of data into the given output stream
64 @param _rxOutput the stream the stream to write to. Must support the
65 css::io::XMarkableStream interface
67 OStreamSection(const css::uno::Reference
<css::io::XDataOutputStream
>& _rxOutput
);
69 /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
70 If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
75 } // namespace comphelper
77 #endif // INCLUDED_COMPHELPER_STREAMSECTION_HXX
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */