Vector BLF: CompressedFile.h Source File

Vector BLF

Loading...
Searching...
No Matches
CompressedFile.h
1// SPDX-FileCopyrightText: 2013-2021 Tobias Lorenz <tobias.lorenz@gmx.net>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7#include <Vector/BLF/platform.h>
8
9#include <fstream>
10#include <mutex>
11
12#include <Vector/BLF/AbstractFile.h>
13
14#include <Vector/BLF/vector_blf_export.h>
15
16namespace Vector {
17namespace BLF {
18
24 class VECTOR_BLF_EXPORT CompressedFile final : public AbstractFile {
25 public:
26 CompressedFile() = default;
27 ~CompressedFile() override;
28 CompressedFile(const CompressedFile &) = delete;
29 CompressedFile & operator=(const CompressedFile &) = delete;
30 CompressedFile(CompressedFile &&) = delete;
31 CompressedFile & operator=(CompressedFile &&) = delete;
32
33 std::streamsize gcount() const override;
34 void read(char * s, std::streamsize n) override;
35 std::streampos tellg() override;
36 void seekg(std::streamoff off, const std::ios_base::seekdir way = std::ios_base::cur) override;
37 void write(const char * s, std::streamsize n) override;
38 std::streampos tellp() override;
39 bool good() const override;
40 bool eof() const override;
41
48 virtual void open(const char * filename, std::ios_base::openmode openMode);
49
55 virtual bool is_open() const;
56
60 virtual void close();
61
67 virtual void seekp(std::streampos pos);
68
69 private:
73 std::fstream m_file {};
74
76 mutable std::mutex m_mutex {};
77};
78
79}
80}
Vector::BLF::CompressedFile
Definition: CompressedFile.h:24
Vector::BLF::AbstractFile
Definition: AbstractFile.h:19