stuff-from-scratch/src/publishing/pdf/PdfXRefTable.h
2022-01-01 18:46:31 +00:00

37 lines
588 B
C++

#pragma once
#include <string>
#include <memory>
#include <vector>
struct XRefRecord
{
unsigned mOffsetBytes{0};
unsigned mGenerationNumber{0};
bool mIsFree{false};
};
struct TableSubSection
{
unsigned mStartIndex{0};
std::vector<XRefRecord> mRecords;
};
class PdfXRefTable
{
public:
PdfXRefTable();
std::string ToString();
unsigned GetNextOffset();
void AddRecord(unsigned numBytes, unsigned generation, unsigned isFree);
unsigned GetNumEntries();
private:
unsigned mLastAddedBytes{0};
std::vector<TableSubSection> mSections;
};