pdfmm 0.9.20
Public Member Functions | List of all members
mm::PdfOutputDevice Class Referenceabstract

#include <PdfOutputDevice.h>

Inheritance diagram for mm::PdfOutputDevice:
mm::PdfNullOutputDevice

Public Member Functions

virtual ~PdfOutputDevice ()
 
void Write (const std::string_view &view)
 
void Put (char ch)
 
size_t Read (char *buffer, size_t len)
 
void Seek (size_t offset)
 
size_t GetLength () const
 
size_t Tell () const
 
void Flush ()
 

Detailed Description

This class provides an output device which operates either on a file or on a buffer in memory. Additionally it can count the bytes written to the device.

This class is suitable for inheritance to provide output devices of your own for pdfmm. Just override the required virtual methods.

Constructor & Destructor Documentation

◆ ~PdfOutputDevice()

PdfOutputDevice::~PdfOutputDevice ( )
virtual

Destruct the PdfOutputDevice object and close any open files.

Member Function Documentation

◆ Flush()

void PdfOutputDevice::Flush ( )

Flush the output files buffer to disk if this devices operates on a disk.

◆ GetLength()

size_t mm::PdfOutputDevice::GetLength ( ) const
inline

The number of bytes written to this object.

Returns
the number of bytes written to this object.
See also
Init

◆ Put()

void PdfOutputDevice::Put ( char  ch)

Write the character in the device

Parameters
chthe character to wrte

◆ Read()

size_t PdfOutputDevice::Read ( char *  buffer,
size_t  len 
)

Read data from the device

Parameters
buffera pointer to the data buffer
lenlength of the output buffer
Returns
Number of read bytes. Return 0 if EOF

◆ Seek()

void PdfOutputDevice::Seek ( size_t  offset)

Seek the device to the position offset from the beginning

Parameters
offsetfrom the beginning of the file

◆ Tell()

size_t mm::PdfOutputDevice::Tell ( ) const
inline

Get the current offset from the beginning of the file.

Returns
the offset form the beginning of the file.

◆ Write()

void PdfOutputDevice::Write ( const std::string_view &  view)

Write the view to the PdfOutputDevice

Parameters
viewthe view to be written