Joedb 10.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
filebuf.h
Go to the documentation of this file.
1#ifndef joedb_filebuf_declared
2#define joedb_filebuf_declared
3
5
6#include <streambuf>
7#include <array>
8
9namespace joedb
10{
11 ///
12 /// https://en.cppreference.com/w/cpp/io/basic_streambuf.html
13 ///
14 /// @ingroup journal
15 class filebuf: public std::streambuf
16 {
17 private:
18 Abstract_File &file;
19 std::array<char, 1 << 13> buffer;
20 pos_type in_pos;
21 pos_type out_pos;
22
23 void syncg();
24 void syncp();
25
26 protected:
27 pos_type seekoff
28 (
29 off_type off,
30 std::ios_base::seekdir dir,
31 std::ios_base::openmode which
32 ) override;
33
34 pos_type seekpos(pos_type pos, std::ios_base::openmode which) override;
35 int sync() override;
36 std::streamsize showmanyc() override;
37 int_type underflow() override;
38 std::streamsize xsgetn(char_type* s, std::streamsize count) override;
39 std::streamsize xsputn(const char_type* s, std::streamsize count) override;
40 int_type overflow(int_type ch) override;
41 int_type pbackfail(int_type c) override;
42
43 public:
45
46 Abstract_File &get_file() {return file;}
47 const Abstract_File &get_file() const {return file;}
48
49 ~filebuf() override;
50 };
51}
52
53#endif
int sync() override
Definition filebuf.cpp:80
pos_type seekpos(pos_type pos, std::ios_base::openmode which) override
Definition filebuf.cpp:63
pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which) override
Definition filebuf.cpp:32
std::streamsize showmanyc() override
Definition filebuf.cpp:89
filebuf(Abstract_File &file)
Definition filebuf.cpp:223
~filebuf() override
Definition filebuf.cpp:234
int_type pbackfail(int_type c) override
Definition filebuf.cpp:191
int_type overflow(int_type ch) override
Definition filebuf.cpp:175
std::streamsize xsputn(const char_type *s, std::streamsize count) override
Definition filebuf.cpp:154
int_type underflow() override
Definition filebuf.cpp:99
Abstract_File & get_file()
Definition filebuf.h:46
const Abstract_File & get_file() const
Definition filebuf.h:47
std::streamsize xsgetn(char_type *s, std::streamsize count) override
Definition filebuf.cpp:115