| Line | |
|---|
| 1 | // -------------------------------------------------------------------------- |
|---|
| 2 | // |
|---|
| 3 | // File |
|---|
| 4 | // Name: FdGetLine.h |
|---|
| 5 | // Purpose: Line based file descriptor reading |
|---|
| 6 | // Created: 2003/07/24 |
|---|
| 7 | // |
|---|
| 8 | // -------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | #ifndef FDGETLINE__H |
|---|
| 11 | #define FDGETLINE__H |
|---|
| 12 | |
|---|
| 13 | #include <string> |
|---|
| 14 | |
|---|
| 15 | #include "GetLine.h" |
|---|
| 16 | |
|---|
| 17 | // -------------------------------------------------------------------------- |
|---|
| 18 | // |
|---|
| 19 | // Class |
|---|
| 20 | // Name: FdGetLine |
|---|
| 21 | // Purpose: Line based file descriptor reading |
|---|
| 22 | // Created: 2003/07/24 |
|---|
| 23 | // |
|---|
| 24 | // -------------------------------------------------------------------------- |
|---|
| 25 | class FdGetLine : public GetLine |
|---|
| 26 | { |
|---|
| 27 | public: |
|---|
| 28 | FdGetLine(int fd); |
|---|
| 29 | virtual ~FdGetLine(); |
|---|
| 30 | private: |
|---|
| 31 | FdGetLine(const FdGetLine &rToCopy); |
|---|
| 32 | |
|---|
| 33 | public: |
|---|
| 34 | virtual std::string GetLine(bool Preprocess = false); |
|---|
| 35 | // Call to detach, setting file pointer correctly to last bit read. |
|---|
| 36 | // Only works for lseek-able file descriptors. |
|---|
| 37 | void DetachFile(); |
|---|
| 38 | // if we read 0 bytes from an fd, it must be end of stream, |
|---|
| 39 | // because we don't support timeouts |
|---|
| 40 | virtual bool IsStreamDataLeft() { return false; } |
|---|
| 41 | |
|---|
| 42 | protected: |
|---|
| 43 | int ReadMore(int Timeout = IOStream::TimeOutInfinite); |
|---|
| 44 | |
|---|
| 45 | private: |
|---|
| 46 | int mFileHandle; |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | #endif // FDGETLINE__H |
|---|
| 50 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.