Ipelib
Classes | Public Member Functions | List of all members
ipe::PdfDict Class Reference

#include <ipepdfparser.h>

Inherits ipe::PdfObj.

Public Member Functions

 PdfDict ()
 
 ~PdfDict ()
 
virtual const PdfDictdict () const noexcept
 
String dictRepr () const noexcept
 
void dictWrite (Stream &stream, const PdfRenumber *renumber, bool inflate, int length) const noexcept
 
virtual void write (Stream &stream, const PdfRenumber *renumber, bool inflate) const noexcept
 
void setStream (const Buffer &stream)
 
void add (String key, const PdfObj *obj)
 
const PdfObjget (String key, const PdfFile *file=nullptr) const noexcept
 
const PdfDictgetDict (String key, const PdfFile *file=nullptr) const noexcept
 
const PdfArraygetArray (String key, const PdfFile *file=nullptr) const noexcept
 
String getName (String key, const PdfFile *file=nullptr) const noexcept
 
bool getNumber (String key, double &val, const PdfFile *file=nullptr) const noexcept
 
int getInteger (String key, const PdfFile *file=nullptr) const noexcept
 
bool getNumberArray (String key, const PdfFile *file, std::vector< double > &vals) const noexcept
 
int count () const noexcept
 
String key (int index) const noexcept
 
const PdfObjvalue (int index) const noexcept
 
Buffer stream () const noexcept
 
bool deflated () const noexcept
 
Buffer inflate () const noexcept
 
void setLateStream (int pos) noexcept
 
int lateStream () const noexcept
 
- Public Member Functions inherited from ipe::PdfObj
virtual ~PdfObj ()=0
 
virtual const PdfNullnull () const noexcept
 
virtual const PdfBoolboolean () const noexcept
 
virtual const PdfNumbernumber () const noexcept
 
virtual const PdfStringstring () const noexcept
 
virtual const PdfNamename () const noexcept
 
virtual const PdfRefref () const noexcept
 
virtual const PdfArrayarray () const noexcept
 
String repr () const noexcept
 

Detailed Description

The PDF dictionary and stream objects.

A dictionary may or may not have attached stream data.

Constructor & Destructor Documentation

◆ PdfDict()

ipe::PdfDict::PdfDict ( )
inlineexplicit

◆ ~PdfDict()

PdfDict::~PdfDict ( )

Member Function Documentation

◆ dict()

const PdfDict * PdfDict::dict ( ) const
virtualnoexcept

Return this object as PDF dictionary object.

Reimplemented from ipe::PdfObj.

◆ dictRepr()

String PdfDict::dictRepr ( ) const
noexcept

Return PDF representation of the PdfDict without the stream.

References dictWrite(), and ipe::Buffer::size().

◆ dictWrite()

void PdfDict::dictWrite ( Stream stream,
const PdfRenumber renumber,
bool  inflate,
int  length 
) const
noexcept

Referenced by dictRepr().

◆ write()

void PdfDict::write ( Stream stream,
const PdfRenumber renumber,
bool  inflate 
) const
virtualnoexcept

Implements ipe::PdfObj.

References ipe::Buffer::size().

◆ setStream()

void PdfDict::setStream ( const Buffer stream)

Add stream data to this dictionary.

References stream().

◆ add()

void PdfDict::add ( String  key,
const PdfObj obj 
)

Add a (key, value) pair to the dictionary.

Dictionary takes ownership of obj.

References key().

◆ get()

const PdfObj * PdfDict::get ( String  key,
const PdfFile file = nullptr 
) const
noexcept

Look up key in dictionary.

Indirect objects (references) are looked up if file is not nullptr, and the object referred to is returned. Returns nullptr if key is not in dictionary.

Referenced by ipe::PdfResources::collect(), deflated(), ipe::Latex::readPdf(), ipe::PdfThumbnail::render(), and ipe::PdfViewBase::setPage().

◆ getDict()

const PdfDict * PdfDict::getDict ( String  key,
const PdfFile file = nullptr 
) const
noexcept

Look up key and return if it is a dictionary.

References ipe::PdfObj::dict().

◆ getArray()

const PdfArray * PdfDict::getArray ( String  key,
const PdfFile file = nullptr 
) const
noexcept

Look up key and return if it is an array.

References ipe::PdfObj::array().

◆ getName()

String PdfDict::getName ( String  key,
const PdfFile file = nullptr 
) const
noexcept

Look up key and return its value if it is a /Name, otherwise return empty string.

References ipe::PdfObj::name(), and ipe::PdfName::value().

◆ getNumber()

bool PdfDict::getNumber ( String  key,
double &  val,
const PdfFile file = nullptr 
) const
noexcept

Retrieve a single number and stor in val.

References ipe::PdfObj::number(), and ipe::PdfNumber::value().

◆ getInteger()

int PdfDict::getInteger ( String  key,
const PdfFile file = nullptr 
) const
noexcept

Retrieve a single integer.

Returns -1 on failure.

◆ getNumberArray()

bool PdfDict::getNumberArray ( String  key,
const PdfFile file,
std::vector< double > &  vals 
) const
noexcept

Retrieve an array of numbers and store in vals.

References ipe::PdfObj::array(), ipe::PdfObj::number(), ipe::PdfArray::obj(), and ipe::PdfNumber::value().

Referenced by ipe::PdfFile::mediaBox().

◆ count()

int ipe::PdfDict::count ( ) const
inlinenoexcept

◆ key()

String ipe::PdfDict::key ( int  index) const
inlinenoexcept

◆ value()

const PdfObj* ipe::PdfDict::value ( int  index) const
inlinenoexcept

◆ stream()

Buffer ipe::PdfDict::stream ( ) const
inlinenoexcept

Referenced by setStream().

◆ deflated()

bool PdfDict::deflated ( ) const
noexcept

Is this stream compressed with flate compression?

References ipe::PdfObj::array(), ipe::PdfArray::count(), get(), ipe::PdfObj::name(), ipe::PdfArray::obj(), and ipe::PdfName::value().

Referenced by inflate().

◆ inflate()

Buffer PdfDict::inflate ( ) const
noexcept

Return the (uncompressed) stream data.

This only handles the /Flate compression.

References ipe::String::data(), deflated(), ipe::InflateSource::getChar(), ipe::String::size(), and ipe::Buffer::size().

◆ setLateStream()

void ipe::PdfDict::setLateStream ( int  pos)
inlinenoexcept

◆ lateStream()

int ipe::PdfDict::lateStream ( ) const
inlinenoexcept

The documentation for this class was generated from the following files: