File: FdGetLine.h

package info (click to toggle)
boxbackup 0.13~~git20221201.g166b3fa-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,172 kB
  • sloc: xml: 70,723; cpp: 55,456; ansic: 24,659; perl: 4,844; sh: 4,294; makefile: 588; python: 311
file content (50 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download | duplicates (4)
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