mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Performance bugfixes
This commit is contained in:
@ -147,6 +147,11 @@ void PDFString::setString(const QByteArray& string)
|
||||
m_string = string;
|
||||
}
|
||||
|
||||
void PDFString::optimize()
|
||||
{
|
||||
m_string.shrink_to_fit();
|
||||
}
|
||||
|
||||
bool PDFArray::equals(const PDFObjectContent* other) const
|
||||
{
|
||||
Q_ASSERT(dynamic_cast<const PDFArray*>(other));
|
||||
@ -159,6 +164,11 @@ void PDFArray::appendItem(PDFObject object)
|
||||
m_objects.push_back(std::move(object));
|
||||
}
|
||||
|
||||
void PDFArray::optimize()
|
||||
{
|
||||
m_objects.shrink_to_fit();
|
||||
}
|
||||
|
||||
bool PDFDictionary::equals(const PDFObjectContent* other) const
|
||||
{
|
||||
Q_ASSERT(dynamic_cast<const PDFDictionary*>(other));
|
||||
@ -194,6 +204,16 @@ const PDFObject& PDFDictionary::get(const char* key) const
|
||||
}
|
||||
}
|
||||
|
||||
void PDFDictionary::optimize()
|
||||
{
|
||||
m_dictionary.shrink_to_fit();
|
||||
|
||||
for (DictionaryEntry& entry : m_dictionary)
|
||||
{
|
||||
entry.first.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<PDFDictionary::DictionaryEntry>::const_iterator PDFDictionary::find(const QByteArray& key) const
|
||||
{
|
||||
return std::find_if(m_dictionary.cbegin(), m_dictionary.cend(), [&key](const DictionaryEntry& entry) { return entry.first == key; });
|
||||
|
Reference in New Issue
Block a user