2015-05-24 21:11:36 +00:00
|
|
|
// Copyright (c) 2005-2015 Jay Berkenbilt
|
2008-04-29 12:55:25 +00:00
|
|
|
//
|
|
|
|
// This file is part of qpdf. This software may be distributed under
|
|
|
|
// the terms of version 2 of the Artistic License which may be found
|
|
|
|
// in the source distribution. It is provided "as is" without express
|
|
|
|
// or implied warranty.
|
|
|
|
|
|
|
|
#ifndef __QPDFOBJECT_HH__
|
|
|
|
#define __QPDFOBJECT_HH__
|
|
|
|
|
2009-10-19 20:17:14 +00:00
|
|
|
#include <qpdf/DLL.h>
|
2009-08-06 19:00:25 +00:00
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
#include <string>
|
|
|
|
|
2010-06-06 13:32:08 +00:00
|
|
|
class QPDF;
|
|
|
|
class QPDFObjectHandle;
|
|
|
|
|
2009-10-21 00:27:24 +00:00
|
|
|
class QPDFObject
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-01-22 14:57:07 +00:00
|
|
|
|
|
|
|
// Objects derived from QPDFObject are accessible through
|
|
|
|
// QPDFObjectHandle. Each object returns a unique type code that
|
|
|
|
// has one of the values in the list below. As new object types
|
|
|
|
// are added to qpdf, additional items may be added to the list,
|
|
|
|
// so code that switches on these values should take that into
|
|
|
|
// consideration.
|
|
|
|
enum object_type_e {
|
|
|
|
// Object types internal to qpdf
|
|
|
|
ot_uninitialized,
|
|
|
|
ot_reserved,
|
|
|
|
// Object types that can occur in the main document
|
|
|
|
ot_null,
|
2013-01-23 14:38:05 +00:00
|
|
|
ot_boolean,
|
2013-01-22 14:57:07 +00:00
|
|
|
ot_integer,
|
|
|
|
ot_real,
|
|
|
|
ot_string,
|
2013-01-23 14:38:05 +00:00
|
|
|
ot_name,
|
2013-01-22 14:57:07 +00:00
|
|
|
ot_array,
|
|
|
|
ot_dictionary,
|
|
|
|
ot_stream,
|
|
|
|
// Additional object types that can occur in content streams
|
2013-01-23 14:38:05 +00:00
|
|
|
ot_operator,
|
2013-01-22 14:57:07 +00:00
|
|
|
ot_inlineimage,
|
|
|
|
};
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
virtual ~QPDFObject() {}
|
|
|
|
virtual std::string unparse() = 0;
|
2010-06-06 13:32:08 +00:00
|
|
|
|
2013-01-22 14:57:07 +00:00
|
|
|
// Return a unique type code for the object
|
|
|
|
virtual object_type_e getTypeCode() const = 0;
|
|
|
|
|
|
|
|
// Return a string literal that describes the type, useful for
|
|
|
|
// debugging and testing
|
|
|
|
virtual char const* getTypeName() const = 0;
|
|
|
|
|
2010-06-06 13:32:08 +00:00
|
|
|
// Accessor to give specific access to non-public methods
|
|
|
|
class ObjAccessor
|
|
|
|
{
|
|
|
|
friend class QPDF;
|
|
|
|
friend class QPDFObjectHandle;
|
|
|
|
private:
|
|
|
|
static void releaseResolved(QPDFObject* o)
|
|
|
|
{
|
|
|
|
if (o)
|
|
|
|
{
|
|
|
|
o->releaseResolved();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
friend class ObjAccessor;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void releaseResolved() {}
|
2008-04-29 12:55:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __QPDFOBJECT_HH__
|