Inheritance diagram for code::LineReader:
This is much faster than walking through a reader character by character.
Sample Use:
include <wdssii/code_LineReader.h> include <wdssii/code_URL.h>
std::string line; URL url = "/tmp/readme.gz"; SmartPtr<LineReader> lineReader = new LineReader (Reader::getReader (url)); while (lineReader->readLine (line)) { do_something_with_line (line); }
Public Member Functions | |
virtual bool | readLine (std::string &setme_line) |
Reads the next line from the Reader. | |
LineReader (SmartPtr< Reader > source) | |
virtual | ~LineReader () |
virtual int | read (Buffer &, long offset=0, size_t max_bytes=0) |
Static Public Member Functions | |
static SmartPtr< LineReader > | getLineReader (const URL &url) |
Convenience function that wraps a lower-level Reader for you. | |
static int | read (const URL &url, Buffer &buffer, long offset=0, size_t max_len=0) |
Convenience function to read `url' into `buf'. | |
static int | read (const URL &url, std::string &s, long offset=0, size_t max_len=0) |
Identical to read(const URL&,Buffer&,long,size_t) except it takes a string instead of a buffer. | |
static int | readRaw (const URL &url, Buffer &b, long offset=0, size_t max_len=0) |
Identical to read() except except it doesn't uncompress files. | |
static SmartPtr< XML::Document > | readXMLDocument (const URL &url) |
Returns an XML::Document created by passing the contents of `url' to XML::Parser::parse(). | |
static SmartPtr< Reader > | getReader (const URL &url) |
Returns a handle to a reader for the given URL. | |
static void | introduceWDSSIIReaders () |
Protected Attributes | |
int | myIndex |
Buffer | myBuf |
virtual code::LineReader::~LineReader | ( | ) | [inline, virtual] |
static SmartPtr<LineReader> code::LineReader::getLineReader | ( | const URL & | url | ) | [inline, static] |
Convenience function that wraps a lower-level Reader for you.
This makes getting a LineReader a little simpler. The following two lines are equivalent:
SmartPtr<LineReader> lineReader = new LineReader (Reader :: getReader (url)); SmartPtr<LineReader> lineReader = LineReader :: getLineReader (url);
Returns a handle to a reader for the given URL.
This is useful when you want to make iterative calls to read() or LineReader::readLine().
static void code::Reader::introduceWDSSIIReaders | ( | ) | [static, inherited] |
static int code::Reader::read | ( | const URL & | url, | |
std::string & | s, | |||
long | offset = 0 , |
|||
size_t | max_len = 0 | |||
) | [static, inherited] |
Identical to read(const URL&,Buffer&,long,size_t) except it takes a string instead of a buffer.
static int code::Reader::read | ( | const URL & | url, | |
Buffer & | buffer, | |||
long | offset = 0 , |
|||
size_t | max_len = 0 | |||
) | [static, inherited] |
Convenience function to read `url' into `buf'.
Handles remote, local, compressed, and uncompressed files transparently.
url | the data source. | |
buffer | where source's contents will be stored. | |
offset | number of bytes to skip before read() begins storing. | |
max_len | if nonzero, maximum number of bytes to store in buf. |
virtual int code::InMemoryReader::read | ( | Buffer & | , | |
long | offset = 0 , |
|||
size_t | max_bytes = 0 | |||
) | [virtual, inherited] |
virtual bool code::LineReader::readLine | ( | std::string & | setme_line | ) | [virtual] |
Reads the next line from the Reader.
setme_line | on success, the Reader's next line is stored here. |
static int code::Reader::readRaw | ( | const URL & | url, | |
Buffer & | b, | |||
long | offset = 0 , |
|||
size_t | max_len = 0 | |||
) | [static, inherited] |
Identical to read() except except it doesn't uncompress files.
This is useful when mirroring compressed files to avoid decompress / recompress steps.
static SmartPtr<XML::Document> code::Reader::readXMLDocument | ( | const URL & | url | ) | [static, inherited] |
Returns an XML::Document created by passing the contents of `url' to XML::Parser::parse().
Buffer code::InMemoryReader::myBuf [protected, inherited] |
int code::InMemoryReader::myIndex [protected, inherited] |