LibreOffice Module vcl (master) 1
BinaryDataContainer.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 */
10
11#pragma once
12
13#include <sal/config.h>
14
15#include <com/sun/star/uno/Sequence.hxx>
16#include <com/sun/star/io/XInputStream.hpp>
17#include <unotools/tempfile.hxx>
18#include <tools/stream.hxx>
19#include <vcl/dllapi.h>
20
21#include <vector>
22#include <memory>
23
30{
31 struct Impl;
32
33 std::shared_ptr<Impl> mpImpl;
34
35 void ensureSwappedIn() const;
36
37public:
39 BinaryDataContainer(SvStream& stream, size_t size);
40
41 BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) = default;
42
43 BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept = default;
44
45 BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer) = default;
46
47 BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) noexcept = default;
48
49 size_t getSize() const;
50 bool isEmpty() const;
51 const sal_uInt8* getData() const;
52 css::uno::Sequence<sal_Int8> getCopyAsByteSequence() const;
53
54 // Returns the data as a readonly stream open for reading
55 std::shared_ptr<SvStream> getAsStream();
56
57 // Returns the data as a readonly stream open for reading
58 css::uno::Reference<css::io::XInputStream> getAsXInputStream();
59
61 std::size_t writeToStream(SvStream& rStream) const;
62
64 std::size_t getSizeBytes() const;
65
67 void swapOut() const;
68
69 size_t calculateHash() const;
70};
71
72/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Container for the binary data, whose responsibility is to manage the make it as simple as possible to...
BinaryDataContainer(const BinaryDataContainer &rBinaryDataContainer)=default
BinaryDataContainer()=default
BinaryDataContainer & operator=(const BinaryDataContainer &rBinaryDataContainer)=default
std::shared_ptr< Impl > mpImpl
BinaryDataContainer & operator=(BinaryDataContainer &&rBinaryDataContainer) noexcept=default
BinaryDataContainer(BinaryDataContainer &&rBinaryDataContainer) noexcept=default
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
unsigned char sal_uInt8