LibreOffice Module oox (master) 1
vbainputstream.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
20#ifndef INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
21#define INCLUDED_OOX_OLE_VBAINPUTSTREAM_HXX
22
23#include <cstddef>
24#include <vector>
25
28#include <sal/types.h>
29
30namespace oox::ole {
31
32
35{
36public:
37 explicit VbaInputStream( BinaryInputStream& rInStrm );
38
40 virtual sal_Int64 size() const override;
42 virtual sal_Int64 tell() const override;
44 virtual void seek( sal_Int64 nPos ) override;
46 virtual void close() override;
47
50 virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
53 virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
55 virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
56
57private:
59 bool updateChunk();
60
61private:
62 typedef ::std::vector< sal_uInt8 > ChunkBuffer;
63
66 size_t mnChunkPos;
67};
68
69
70} // namespace oox::ole
71
72#endif
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Interface for binary input stream classes.
A non-seekable input stream that implements run-length decompression.
VbaInputStream(BinaryInputStream &rInStrm)
virtual sal_Int64 tell() const override
Returns -1, stream position is not tracked.
virtual void close() override
Closes the input stream but not the wrapped stream.
virtual void seek(sal_Int64 nPos) override
Does nothing, stream is not seekable.
virtual sal_Int32 readMemory(void *opMem, sal_Int32 nBytes, size_t nAtomSize=1) override
Reads nBytes bytes to the (existing) buffer opMem.
virtual sal_Int64 size() const override
Returns -1, stream size is not determinable.
BinaryInputStream * mpInStrm
virtual sal_Int32 readData(StreamDataSequence &orData, sal_Int32 nBytes, size_t nAtomSize=1) override
Reads nBytes bytes to the passed sequence.
::std::vector< sal_uInt8 > ChunkBuffer
virtual void skip(sal_Int32 nBytes, size_t nAtomSize=1) override
Seeks the stream forward by the passed number of bytes.
bool updateChunk()
If no data left in chunk buffer, reads the next chunk from stream.
sal_uInt16 nPos
css::uno::Sequence< sal_Int8 > StreamDataSequence