PDF4QT/PdfForQtLib/sources/pdfdocument.h

70 lines
2.1 KiB
C
Raw Normal View History

2018-11-17 16:48:30 +01:00
// Copyright (C) 2018 Jakub Melka
//
// This file is part of PdfForQt.
//
// PdfForQt is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// PdfForQt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDFForQt. If not, see <https://www.gnu.org/licenses/>.
#ifndef PDFDOCUMENT_H
#define PDFDOCUMENT_H
#include "pdfglobal.h"
2018-11-25 14:48:08 +01:00
#include "pdfobject.h"
2018-11-17 16:48:30 +01:00
namespace pdf
{
2018-11-25 14:48:08 +01:00
/// Storage for objects. This class is not thread safe for writing (calling non-const functions). Caller must ensure
/// locking, if this object is used from multiple threads. Calling const functions should be thread safe.
class PDFObjectStorage
{
public:
constexpr inline PDFObjectStorage() = default;
constexpr inline PDFObjectStorage(const PDFObjectStorage&) = default;
constexpr inline PDFObjectStorage(PDFObjectStorage&&) = default;
constexpr inline PDFObjectStorage& operator=(const PDFObjectStorage&) = default;
constexpr inline PDFObjectStorage& operator=(PDFObjectStorage&&) = default;
struct Entry
{
constexpr inline explicit Entry() = default;
inline explicit Entry(PDFInteger generation, PDFObject object) : generation(generation), object(std::move(object)) { }
PDFInteger generation = 0;
PDFObject object;
};
using PDFObjects = std::vector<Entry>;
private:
PDFObjects m_pdfObjects;
};
2018-11-17 16:48:30 +01:00
class PDFDocument
{
public:
explicit PDFDocument() = default;
2018-11-25 14:48:08 +01:00
private:
/// Storage of objects
PDFObjectStorage m_pdfObjectStorage;
2018-11-17 16:48:30 +01:00
};
} // namespace pdf
#endif // PDFDOCUMENT_H