mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 08:02:11 +00:00
6c61be00e8
This is in preparation for restoring a QPDFObject.hh to ease the transition on qpdf_object_type_e. This commit was created by * Renaming QPDFObject.cc and QPDFObject.hh * Replacing QPDFObject\b with QPDFValueProxy (where \b is word boundary) * Running format-code * Manually resorting files in libqpdf/CMakeLists.txt * Manually refilling the comment in QPDF.hh near class Resolver
107 lines
2.2 KiB
C++
107 lines
2.2 KiB
C++
#ifndef QPDFVALUE_HH
|
|
#define QPDFVALUE_HH
|
|
|
|
#include <qpdf/Constants.h>
|
|
#include <qpdf/DLL.h>
|
|
#include <qpdf/JSON.hh>
|
|
#include <qpdf/QPDFObjGen.hh>
|
|
#include <qpdf/Types.h>
|
|
|
|
#include <string>
|
|
|
|
class QPDF;
|
|
class QPDFObjectHandle;
|
|
class QPDFValueProxy;
|
|
|
|
class QPDFValue
|
|
{
|
|
friend class QPDFValueProxy;
|
|
|
|
public:
|
|
virtual ~QPDFValue() = default;
|
|
|
|
virtual std::shared_ptr<QPDFValueProxy> shallowCopy() = 0;
|
|
virtual std::string unparse() = 0;
|
|
virtual JSON getJSON(int json_version) = 0;
|
|
virtual void
|
|
setDescription(QPDF* qpdf, std::string const& description)
|
|
{
|
|
owning_qpdf = qpdf;
|
|
object_description = description;
|
|
}
|
|
bool
|
|
getDescription(QPDF*& qpdf, std::string& description)
|
|
{
|
|
qpdf = owning_qpdf;
|
|
description = object_description;
|
|
return owning_qpdf != nullptr;
|
|
}
|
|
bool
|
|
hasDescription()
|
|
{
|
|
return owning_qpdf != nullptr;
|
|
}
|
|
void
|
|
setParsedOffset(qpdf_offset_t offset)
|
|
{
|
|
if (parsed_offset < 0) {
|
|
parsed_offset = offset;
|
|
}
|
|
}
|
|
qpdf_offset_t
|
|
getParsedOffset()
|
|
{
|
|
return parsed_offset;
|
|
}
|
|
QPDF*
|
|
getQPDF()
|
|
{
|
|
return qpdf;
|
|
}
|
|
QPDFObjGen
|
|
getObjGen()
|
|
{
|
|
return og;
|
|
}
|
|
|
|
protected:
|
|
QPDFValue() :
|
|
type_code(::ot_uninitialized),
|
|
type_name("uninitialized")
|
|
{
|
|
}
|
|
QPDFValue(qpdf_object_type_e type_code, char const* type_name) :
|
|
type_code(type_code),
|
|
type_name(type_name)
|
|
{
|
|
}
|
|
QPDFValue(
|
|
qpdf_object_type_e type_code,
|
|
char const* type_name,
|
|
QPDF* qpdf,
|
|
QPDFObjGen const& og) :
|
|
type_code(type_code),
|
|
type_name(type_name),
|
|
qpdf(qpdf),
|
|
og(og)
|
|
{
|
|
}
|
|
|
|
static std::shared_ptr<QPDFValueProxy> do_create(QPDFValue*);
|
|
|
|
private:
|
|
QPDFValue(QPDFValue const&) = delete;
|
|
QPDFValue& operator=(QPDFValue const&) = delete;
|
|
QPDF* owning_qpdf{nullptr};
|
|
std::string object_description;
|
|
qpdf_offset_t parsed_offset{-1};
|
|
const qpdf_object_type_e type_code;
|
|
char const* type_name;
|
|
|
|
protected:
|
|
QPDF* qpdf{nullptr};
|
|
QPDFObjGen og;
|
|
};
|
|
|
|
#endif // QPDFVALUE_HH
|