fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / comphelper / streamsection.hxx
blob40ea508f888b3d1ed41fcfa46ba8608f0c8fe324
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _COMPHELPER_STREAMSECTION_HXX_
21 #define _COMPHELPER_STREAMSECTION_HXX_
23 #include <com/sun/star/io/XMarkableStream.hpp>
24 #include <com/sun/star/io/XDataInputStream.hpp>
25 #include <com/sun/star/io/XDataOutputStream.hpp>
26 #include "comphelper/comphelperdllapi.h"
28 namespace comphelper
31 namespace stario = ::com::sun::star::io;
32 namespace staruno = ::com::sun::star::uno;
34 /** implements handling for compatibly reading/writing data from/into an input/output stream.
35 data written in a block secured by this class should be readable by older versions which
36 use the same mechanism.
38 @author Frank Schoenheit
39 @since 00/26/05
42 class COMPHELPER_DLLPUBLIC OStreamSection
44 staruno::Reference< stario::XMarkableStream > m_xMarkStream;
45 staruno::Reference< stario::XDataInputStream > m_xInStream;
46 staruno::Reference< stario::XDataOutputStream > m_xOutStream;
48 sal_Int32 m_nBlockStart;
49 sal_Int32 m_nBlockLen;
51 public:
52 /** starts reading of a "skippable" section of data within the given input stream<BR>
53 @param _rxInput the stream to read from. Must support the
54 <type scope="com::sun::star::io">XMarkableStream</type> interface
56 OStreamSection(const staruno::Reference< stario::XDataInputStream >& _rxInput);
58 /** starts writing of a "skippable" section of data into the given output stream
59 @param _rxOutput the stream the stream to write to. Must support the
60 <type scope="com::sun::star::io">XMarkableStream</type> interface
61 @param _nPresumedLength estimation for the length of the upcoming section. If greater 0, this
62 value will be written as section length and corrected (in the dtor) only if
63 needed. If you know how much bytes you are about to write, you may
64 want to use this param, saving some stream operations this way.
66 OStreamSection(const staruno::Reference< stario::XDataOutputStream >& _rxOutput, sal_Int32 _nPresumedLength = 0);
68 /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
69 If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
71 ~OStreamSection();
74 } // namespace comphelper
76 #endif // _COMPHELPER_STREAMSECTION_HXX_
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */