blob: 2b9c268ff198e3f84c7826638c1abf57da34f580 (
plain)
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
|
// --------------------------------------------------------------------------
//
// File
// Name: FdGetLine.h
// Purpose: Line based file descriptor reading
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
#ifndef FDGETLINE__H
#define FDGETLINE__H
#include <string>
#include "GetLine.h"
// --------------------------------------------------------------------------
//
// Class
// Name: FdGetLine
// Purpose: Line based file descriptor reading
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
class FdGetLine : public GetLine
{
public:
FdGetLine(int fd);
virtual ~FdGetLine();
private:
FdGetLine(const FdGetLine &rToCopy);
public:
virtual std::string GetLine(bool Preprocess = false);
// Call to detach, setting file pointer correctly to last bit read.
// Only works for lseek-able file descriptors.
void DetachFile();
// if we read 0 bytes from an fd, it must be end of stream,
// because we don't support timeouts
virtual bool IsStreamDataLeft() { return false; }
protected:
int ReadMore(int Timeout = IOStream::TimeOutInfinite);
private:
int mFileHandle;
};
#endif // FDGETLINE__H
|