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
16 namespace Vector {
17 namespace 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::seekg
void seekg(std::streamoff off, const std::ios_base::seekdir way=std::ios_base::cur) override
Definition CompressedFile.cpp:35
Vector::BLF::CompressedFile::gcount
std::streamsize gcount() const override
Definition CompressedFile.cpp:14
Vector::BLF::CompressedFile::good
bool good() const override
Definition CompressedFile.cpp:56
Vector::BLF::CompressedFile::write
void write(const char *s, std::streamsize n) override
Definition CompressedFile.cpp:42
Vector::BLF::CompressedFile::is_open
virtual bool is_open() const
Definition CompressedFile.cpp:77
Vector::BLF::CompressedFile::open
virtual void open(const char *filename, std::ios_base::openmode openMode)
Definition CompressedFile.cpp:70
Vector::BLF::CompressedFile::seekp
virtual void seekp(std::streampos pos)
Definition CompressedFile.cpp:91
Vector::BLF::CompressedFile::close
virtual void close()
Definition CompressedFile.cpp:84
Vector::BLF::CompressedFile::tellg
std::streampos tellg() override
Definition CompressedFile.cpp:28
Vector::BLF::CompressedFile::tellp
std::streampos tellp() override
Definition CompressedFile.cpp:49
Vector::BLF::CompressedFile::read
void read(char *s, std::streamsize n) override
Definition CompressedFile.cpp:21
Vector::BLF::CompressedFile::eof
bool eof() const override
Definition CompressedFile.cpp:63