58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#include "PdfObject.h"
|
|
|
|
#include "PdfDictionary.h"
|
|
#include "PdfXRefTable.h"
|
|
|
|
std::string PdfObject::ToString(PdfXRefTable* xRefTable)
|
|
{
|
|
UpdateDictionary();
|
|
|
|
auto content = GetStringPrefix();
|
|
content += mDictionary.ToString();
|
|
content += GetStringSuffix();
|
|
|
|
xRefTable->AddRecord(content.size(), mGenerationNumber, mIsFree);
|
|
return content;
|
|
}
|
|
|
|
void PdfObject::UpdateDictionary()
|
|
{
|
|
|
|
}
|
|
|
|
std::string PdfObject::GetStringSuffix() const
|
|
{
|
|
return "endobj\n\n";
|
|
}
|
|
|
|
unsigned PdfObject::IndexObjects(unsigned count)
|
|
{
|
|
const auto newCount = count + 1;
|
|
mObjectNumber = newCount;
|
|
return newCount;
|
|
}
|
|
|
|
void PdfObject::SetObjectNumber(unsigned num)
|
|
{
|
|
mObjectNumber = num;
|
|
}
|
|
|
|
void PdfObject::SetGenerationNumber(unsigned num)
|
|
{
|
|
mGenerationNumber = num;
|
|
}
|
|
|
|
std::string PdfObject::GetStringPrefix() const
|
|
{
|
|
return std::to_string(mObjectNumber) + " " + std::to_string(mGenerationNumber) + " obj\n";
|
|
}
|
|
|
|
std::string PdfObject::GetRefString() const
|
|
{
|
|
return std::to_string(mObjectNumber) + " " + std::to_string(mGenerationNumber) + " R";
|
|
}
|
|
|
|
bool PdfObject::IsFree() const
|
|
{
|
|
return mIsFree;
|
|
}
|