FilteringInputStreambuf< Extractor > Class Template Reference

Delivers characters from an istream or streambuf from a source while filtering. More...

#include <openbabel/lineend.h>

List of all members.

Public Member Functions

 FilteringInputStreambuf (std::streambuf *source=NULL, bool deleteWhenFinished=false)
virtual ~FilteringInputStreambuf ()
virtual int overflow (int)
virtual int underflow ()
virtual int sync ()
virtual std::streampos seekoff (std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
virtual std::streampos seekpos (std::streampos sp, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
std::streambuf * GetSource () const
void SetSource (std::streambuf *newsource)

Detailed Description

template<class Extractor>
class OpenBabel::FilteringInputStreambuf< Extractor >

Delivers characters from an istream or streambuf from a source while filtering.

Based on an article by James Kanze, "Filtering Streambufs"

A FilteringInputStreambuf delivers characters on request to an istream or a destination rdbuf(). It receives them from a source rdbuf. In doing the transfer it filters them in a way decided by the class specified in template parameter Extractor.

seekg and tellg requests from the stream are passed through to source rdbuf. This allows return to a position in the input data that was previously noted. This is adequate to allow OpenBabel's fastsearch indexing, but may not be good enough for some other applications that use random access.

A class LineEndingExtractor converts DOS and MAC line endings to the UNIX line ending.

This filtering process is potentially extendable, with a chain of FilteringInputStreambufs each carrying out its filtering task. For instance a decompression streambuf could feed a LineEnding filter, which in tern was read by an input stream.

Constructor & Destructor Documentation

FilteringInputStreambuf ( std::streambuf *  source = NULL,
bool  deleteWhenFinished = false 
virtual ~FilteringInputStreambuf (  )  [inline, virtual]

Member Function Documentation

virtual int overflow ( int   )  [inline, virtual]
int underflow (  )  [virtual]
int sync (  )  [virtual]
virtual std::streampos seekoff ( std::streamoff  off,
std::ios_base::seekdir  way,
std::ios_base::openmode  which = std::ios_base::in | std::ios_base::out 
) [inline, virtual]
virtual std::streampos seekpos ( std::streampos  sp,
std::ios_base::openmode  which = std::ios_base::in | std::ios_base::out 
) [inline, virtual]
std::streambuf* GetSource (  )  const [inline]

Returns current source.

void SetSource ( std::streambuf *  newsource  )  [inline]

Changes the source.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines