blob: 1b5370316028222e4306609efc8fc6efa17111f5 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// --------------------------------------------------------------------------
//
// File
// Name: IOStreamGetLine.h
// Purpose: Line based file descriptor reading
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
#ifndef IOSTREAMGETLINE__H
#define IOSTREAMGETLINE__H
#include <string>
#include "GetLine.h"
#include "IOStream.h"
// --------------------------------------------------------------------------
//
// Class
// Name: IOStreamGetLine
// Purpose: Line based stream reading
// Created: 2003/07/24
//
// --------------------------------------------------------------------------
class IOStreamGetLine : public GetLine
{
public:
IOStreamGetLine(IOStream &Stream);
virtual ~IOStreamGetLine();
private:
IOStreamGetLine(const IOStreamGetLine &rToCopy);
public:
bool GetLine(std::string &rOutput, bool Preprocess = false, int Timeout = IOStream::TimeOutInfinite);
std::string GetLine()
{
std::string output;
GetLine(output);
return output;
}
// Call to detach, setting file pointer correctly to last bit read.
// Only works for lseek-able file descriptors.
void DetachFile();
virtual bool IsStreamDataLeft()
{
return mrStream.StreamDataLeft();
}
// For doing interesting stuff with the remaining data...
// Be careful with this!
const void *GetBufferedData() const {return mBuffer + mBufferBegin;}
int GetSizeOfBufferedData() const {return mBytesInBuffer - mBufferBegin;}
void IgnoreBufferedData(int BytesToIgnore);
IOStream &GetUnderlyingStream() {return mrStream;}
protected:
int ReadMore(int Timeout = IOStream::TimeOutInfinite);
private:
IOStream &mrStream;
};
#endif // IOSTREAMGETLINE__H
|