Text operators (first part)

This commit is contained in:
Jakub Melka
2019-03-25 18:44:45 +01:00
parent 8c417b2afb
commit 21e125bd40
9 changed files with 5198 additions and 20 deletions

View File

@ -288,6 +288,18 @@ PDFReal PDFDocumentDataLoaderDecorator::readNumber(const PDFObject& object, PDFR
return defaultValue;
}
bool PDFDocumentDataLoaderDecorator::readBoolean(const PDFObject& object, bool defaultValue) const
{
const PDFObject& dereferencedObject = m_document->getObject(object);
if (dereferencedObject.isBool())
{
return dereferencedObject.getBool();
}
return defaultValue;
}
QString PDFDocumentDataLoaderDecorator::readTextString(const PDFObject& object, const QString& defaultValue) const
{
const PDFObject& dereferencedObject = m_document->getObject(object);
@ -436,4 +448,14 @@ std::vector<PDFInteger> PDFDocumentDataLoaderDecorator::readIntegerArray(const P
return std::vector<PDFInteger>();
}
bool PDFDocumentDataLoaderDecorator::readBooleanFromDictionary(const PDFDictionary* dictionary, const char* key, bool defaultValue) const
{
if (dictionary->hasKey(key))
{
return readBoolean(dictionary->get(key), defaultValue);
}
return defaultValue;
}
} // namespace pdf