PoDoFo  0.9.4
Public Member Functions | Protected Member Functions | List of all members
PoDoFo::PdfInputDevice Class Reference

#include <PdfInputDevice.h>

Public Member Functions

 PdfInputDevice (const char *pszFilename)
 PdfInputDevice (const char *pBuffer, size_t lLen)
 PdfInputDevice (const std::istream *pInStream)
virtual ~PdfInputDevice ()
virtual void Close ()
virtual std::streamoff Tell () const
virtual int GetChar () const
virtual int Look () const
virtual void Seek (std::streamoff off, std::ios_base::seekdir dir=std::ios_base::beg)
virtual std::streamoff Read (char *pBuffer, std::streamsize lLen)
virtual PODOFO_NOTHROW bool Eof () const
virtual PODOFO_NOTHROW bool Bad () const
virtual PODOFO_NOTHROW void Clear (std::ios_base::iostate state=std::ios_base::goodbit) const
PODOFO_NOTHROW bool IsSeekable () const

Protected Member Functions

PODOFO_NOTHROW void SetSeekable (bool bIsSeekable)
 PdfInputDevice ()

Detailed Description

This class provides an Input device which operates either on a file, a buffer in memory or any arbitrary std::istream

This class is suitable for inheritance to provide input devices of your own for PoDoFo. Just overide the required virtual methods.

Constructor & Destructor Documentation

PoDoFo::PdfInputDevice::PdfInputDevice ( const char *  pszFilename)

Construct a new PdfInputDevice that reads all data from a file.

pszFilenamepath to a file that will be opened and all data is read from this file.
PoDoFo::PdfInputDevice::PdfInputDevice ( const char *  pBuffer,
size_t  lLen 

Construct a new PdfInputDevice that reads all data from a memory buffer. The buffer will not be owned by this object - it is COPIED.

pBuffera buffer in memory
lLenthe length of the buffer in memory
PoDoFo::PdfInputDevice::PdfInputDevice ( const std::istream *  pInStream)

Construct a new PdfInputDevice that reads all data from a std::istream.

pInStreamread from this std::istream
PoDoFo::PdfInputDevice::~PdfInputDevice ( )

Destruct the PdfInputDevice object and close any open files.

PoDoFo::PdfInputDevice::PdfInputDevice ( )

CAN NOT Construct a new PdfInputDevice without an input source. However subclasses may well need to do just that.

Member Function Documentation

bool PoDoFo::PdfInputDevice::Bad ( ) const
True if there was an error in an I/O operation
void PoDoFo::PdfInputDevice::Clear ( std::ios_base::iostate  state = std::ios_base::goodbit) const

Set the stream error state. By default, clears badbit, eofbit and failbit.

void PoDoFo::PdfInputDevice::Close ( )

Close the input device. No further operations may be performed on this device after calling this function.

bool PoDoFo::PdfInputDevice::Eof ( ) const
True if the stream is at EOF
int PoDoFo::PdfInputDevice::GetChar ( ) const

Get next char from stream.

the next character from the stream
bool PoDoFo::PdfInputDevice::IsSeekable ( ) const
True if the stream is seekable. Subclasses can control this value with SetIsSeekable(bool) .
int PoDoFo::PdfInputDevice::Look ( ) const

Peek at next char in stream. /returns the next char in the stream

std::streamoff PoDoFo::PdfInputDevice::Read ( char *  pBuffer,
std::streamsize  lLen 

Read a certain number of bytes from the input device.

pBufferstore bytes in this buffer. The buffer has to be large enough.
lLennumber of bytes to read.
the number of bytes that have been read. If reading was successfull the number of read bytes is equal to lLen.
void PoDoFo::PdfInputDevice::Seek ( std::streamoff  off,
std::ios_base::seekdir  dir = std::ios_base::beg 

Seek the device to the position offset from the begining

offfrom the beginning of the file
dirwhere to start (start, cur, end)

A non-seekable input device will throw an InvalidDeviceOperation.

void PoDoFo::PdfInputDevice::SetSeekable ( bool  bIsSeekable)

Control whether or or not this stream is flagged seekable.

std::streamoff PoDoFo::PdfInputDevice::Tell ( ) const

Get the current position in file. /returns the current position in the file