source: box/trunk/lib/common/IOStreamGetLine.h @ 2961

Revision 2961, 1.6 KB checked in by chris, 13 months ago (diff)

Another virtual destructor, this time for IOStreamGetLine.

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    IOStreamGetLine.h
5//              Purpose: Line based file descriptor reading
6//              Created: 2003/07/24
7//
8// --------------------------------------------------------------------------
9
10#ifndef IOSTREAMGETLINE__H
11#define IOSTREAMGETLINE__H
12
13#include <string>
14
15#include "GetLine.h"
16#include "IOStream.h"
17
18// --------------------------------------------------------------------------
19//
20// Class
21//              Name:    IOStreamGetLine
22//              Purpose: Line based stream reading
23//              Created: 2003/07/24
24//
25// --------------------------------------------------------------------------
26class IOStreamGetLine : public GetLine
27{
28public:
29        IOStreamGetLine(IOStream &Stream);
30        virtual ~IOStreamGetLine();
31private:
32        IOStreamGetLine(const IOStreamGetLine &rToCopy);
33
34public:
35        bool GetLine(std::string &rOutput, bool Preprocess = false, int Timeout = IOStream::TimeOutInfinite);
36       
37        // Call to detach, setting file pointer correctly to last bit read.
38        // Only works for lseek-able file descriptors.
39        void DetachFile();
40       
41        virtual bool IsStreamDataLeft()
42        {
43                return mrStream.StreamDataLeft();
44        }
45       
46        // For doing interesting stuff with the remaining data...
47        // Be careful with this!
48        const void *GetBufferedData() const {return mBuffer + mBufferBegin;}
49        int GetSizeOfBufferedData() const {return mBytesInBuffer - mBufferBegin;}
50        void IgnoreBufferedData(int BytesToIgnore);
51        IOStream &GetUnderlyingStream() {return mrStream;}
52
53protected:
54        int ReadMore(int Timeout = IOStream::TimeOutInfinite);
55       
56private:
57        IOStream &mrStream;
58};
59
60#endif // IOSTREAMGETLINE__H
61
Note: See TracBrowser for help on using the repository browser.