-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsyszux_stream_buffer.h
34 lines (29 loc) · 1.22 KB
/
syszux_stream_buffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2020 Gemfield <gemfield@civilnet.cn>
* This file is part of libdeepvac, licensed under the GPLv3 (the "License")
* You may not use this file except in compliance with the License.
*/
#pragma once
#include <istream>
#include <streambuf>
class SyszuxStreamBuffer : public std::streambuf
{
public:
SyszuxStreamBuffer(const uint8_t *begin, const size_t size);
SyszuxStreamBuffer() = delete;
SyszuxStreamBuffer(const SyszuxStreamBuffer&) = delete;
SyszuxStreamBuffer& operator=(const SyszuxStreamBuffer&) = delete;
SyszuxStreamBuffer(SyszuxStreamBuffer&&) = default;
SyszuxStreamBuffer& operator=(SyszuxStreamBuffer&&) = default;
private:
int_type underflow();
int_type uflow();
int_type pbackfail(int_type ch);
std::streamsize showmanyc();
std::streampos seekoff ( std::streamoff off, std::ios_base::seekdir way,std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
std::streampos seekpos ( std::streampos sp,std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
private:
const uint8_t * const begin_;
const uint8_t * const end_;
const uint8_t * current_;
};