#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;
};
