-
Notifications
You must be signed in to change notification settings - Fork 1
/
Reader.h
53 lines (45 loc) · 981 Bytes
/
Reader.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Reader.h
*
* Created on: ۷ بهمن ۱۳۹۶
*
* Copyright Hedayat Vatankhah <[email protected]>, 2018-2022.
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef READER_H_
#define READER_H_
#include <stdio.h>
#include <string>
#include <istream>
#ifdef __GLIBCXX__
#include <ext/stdio_filebuf.h>
#endif
class Reader
{
public:
Reader(FILE *input_file);
const char *ReadLine();
protected:
FILE *in_file;
#ifdef __GLIBCXX__
__gnu_cxx::stdio_filebuf<char> filebuf;
std::istream in_stream;
#endif
std::string line_buffer;
};
class FileReader: public Reader
{
public:
FileReader(std::string file_name);
~FileReader();
};
class PipeReader: public Reader
{
public:
PipeReader(std::string cmd);
~PipeReader();
};
#endif /* READER_H_ */