mirror of
https://github.com/qpdf/qpdf.git
synced 2025-02-07 06:08:26 +00:00
Remove virtual methods QPDFValue::getTypeCode and getTypeName
This commit is contained in:
parent
27fae2b55e
commit
c7005e8a6d
@ -87,7 +87,7 @@ class QPDFObject
|
||||
object_type_e
|
||||
getTypeCode() const
|
||||
{
|
||||
return value->getTypeCode();
|
||||
return value->type_code;
|
||||
}
|
||||
|
||||
// Return a string literal that describes the type, useful for
|
||||
@ -95,9 +95,8 @@ class QPDFObject
|
||||
char const*
|
||||
getTypeName() const
|
||||
{
|
||||
return value->getTypeName();
|
||||
return value->type_name;
|
||||
}
|
||||
|
||||
void
|
||||
setDescription(QPDF* qpdf, std::string const& description)
|
||||
{
|
||||
|
@ -43,8 +43,6 @@ class QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy() = 0;
|
||||
virtual std::string unparse() = 0;
|
||||
virtual JSON getJSON(int json_version) = 0;
|
||||
virtual qpdf_object_type_e getTypeCode() const = 0;
|
||||
virtual char const* getTypeName() const = 0;
|
||||
virtual void
|
||||
setDescription(QPDF* qpdf, std::string const& description)
|
||||
{
|
||||
@ -75,7 +73,17 @@ class QPDFValue
|
||||
}
|
||||
|
||||
protected:
|
||||
QPDFValue() = default;
|
||||
QPDFValue() :
|
||||
type_code(::ot_uninitialized),
|
||||
type_name("uninitilized")
|
||||
{
|
||||
}
|
||||
QPDFValue(qpdf_object_type_e type_code, char const* type_name) :
|
||||
type_code(type_code),
|
||||
type_name(type_name)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void
|
||||
releaseResolved()
|
||||
{
|
||||
@ -88,6 +96,8 @@ class QPDFValue
|
||||
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;
|
||||
};
|
||||
|
||||
#endif // QPDFVALUE_HH
|
||||
|
@ -4,12 +4,14 @@
|
||||
#include <qpdf/QUtil.hh>
|
||||
#include <stdexcept>
|
||||
|
||||
QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& v)
|
||||
QPDF_Array::QPDF_Array(std::vector<QPDFObjectHandle> const& v) :
|
||||
QPDFValue(::ot_array, "array")
|
||||
{
|
||||
setFromVector(v);
|
||||
}
|
||||
|
||||
QPDF_Array::QPDF_Array(SparseOHArray const& items) :
|
||||
QPDFValue(::ot_array, "array"),
|
||||
elements(items)
|
||||
{
|
||||
}
|
||||
@ -62,18 +64,6 @@ QPDF_Array::getJSON(int json_version)
|
||||
return j;
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Array::getTypeCode() const
|
||||
{
|
||||
return ::ot_array;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Array::getTypeName() const
|
||||
{
|
||||
return "array";
|
||||
}
|
||||
|
||||
int
|
||||
QPDF_Array::getNItems() const
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <qpdf/QPDF_Bool.hh>
|
||||
|
||||
QPDF_Bool::QPDF_Bool(bool val) :
|
||||
QPDFValue(::ot_boolean, "boolean"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
@ -29,18 +30,6 @@ QPDF_Bool::getJSON(int json_version)
|
||||
return JSON::makeBool(this->val);
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Bool::getTypeCode() const
|
||||
{
|
||||
return ::ot_boolean;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Bool::getTypeName() const
|
||||
{
|
||||
return "boolean";
|
||||
}
|
||||
|
||||
bool
|
||||
QPDF_Bool::getVal() const
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
QPDF_Dictionary::QPDF_Dictionary(
|
||||
std::map<std::string, QPDFObjectHandle> const& items) :
|
||||
QPDFValue(::ot_dictionary, "dictionary"),
|
||||
items(items)
|
||||
{
|
||||
}
|
||||
@ -57,18 +58,6 @@ QPDF_Dictionary::getJSON(int json_version)
|
||||
return j;
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Dictionary::getTypeCode() const
|
||||
{
|
||||
return ::ot_dictionary;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Dictionary::getTypeName() const
|
||||
{
|
||||
return "dictionary";
|
||||
}
|
||||
|
||||
bool
|
||||
QPDF_Dictionary::hasKey(std::string const& key)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <qpdf/QPDF_InlineImage.hh>
|
||||
|
||||
QPDF_InlineImage::QPDF_InlineImage(std::string const& val) :
|
||||
QPDFValue(::ot_inlineimage, "inline-image"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
@ -29,18 +30,6 @@ QPDF_InlineImage::getJSON(int json_version)
|
||||
return JSON::makeNull();
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_InlineImage::getTypeCode() const
|
||||
{
|
||||
return ::ot_inlineimage;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_InlineImage::getTypeName() const
|
||||
{
|
||||
return "inline-image";
|
||||
}
|
||||
|
||||
std::string
|
||||
QPDF_InlineImage::getVal() const
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <qpdf/QUtil.hh>
|
||||
|
||||
QPDF_Integer::QPDF_Integer(long long val) :
|
||||
QPDFValue(::ot_integer, "integer"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
@ -31,18 +32,6 @@ QPDF_Integer::getJSON(int json_version)
|
||||
return JSON::makeInt(this->val);
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Integer::getTypeCode() const
|
||||
{
|
||||
return ::ot_integer;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Integer::getTypeName() const
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
|
||||
long long
|
||||
QPDF_Integer::getVal() const
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string.h>
|
||||
|
||||
QPDF_Name::QPDF_Name(std::string const& name) :
|
||||
QPDFValue(::ot_name, "name"),
|
||||
name(name)
|
||||
{
|
||||
}
|
||||
@ -61,18 +62,6 @@ QPDF_Name::getJSON(int json_version)
|
||||
}
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Name::getTypeCode() const
|
||||
{
|
||||
return ::ot_name;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Name::getTypeName() const
|
||||
{
|
||||
return "name";
|
||||
}
|
||||
|
||||
std::string
|
||||
QPDF_Name::getName() const
|
||||
{
|
||||
|
@ -1,5 +1,10 @@
|
||||
#include <qpdf/QPDF_Null.hh>
|
||||
|
||||
QPDF_Null::QPDF_Null() :
|
||||
QPDFValue(::ot_null, "null")
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<QPDFObject>
|
||||
QPDF_Null::create()
|
||||
{
|
||||
@ -23,15 +28,3 @@ QPDF_Null::getJSON(int json_version)
|
||||
{
|
||||
return JSON::makeNull();
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Null::getTypeCode() const
|
||||
{
|
||||
return ::ot_null;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Null::getTypeName() const
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <qpdf/QPDF_Operator.hh>
|
||||
|
||||
QPDF_Operator::QPDF_Operator(std::string const& val) :
|
||||
QPDFValue(::ot_operator, "operator"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
@ -29,18 +30,6 @@ QPDF_Operator::getJSON(int json_version)
|
||||
return JSON::makeNull();
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Operator::getTypeCode() const
|
||||
{
|
||||
return ::ot_operator;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Operator::getTypeName() const
|
||||
{
|
||||
return "operator";
|
||||
}
|
||||
|
||||
std::string
|
||||
QPDF_Operator::getVal() const
|
||||
{
|
||||
|
@ -3,12 +3,14 @@
|
||||
#include <qpdf/QUtil.hh>
|
||||
|
||||
QPDF_Real::QPDF_Real(std::string const& val) :
|
||||
QPDFValue(::ot_real, "real"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
|
||||
QPDF_Real::QPDF_Real(
|
||||
double value, int decimal_places, bool trim_trailing_zeroes) :
|
||||
QPDFValue(::ot_real, "real"),
|
||||
val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
|
||||
{
|
||||
}
|
||||
@ -60,18 +62,6 @@ QPDF_Real::getJSON(int json_version)
|
||||
return JSON::makeNumber(result);
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Real::getTypeCode() const
|
||||
{
|
||||
return ::ot_real;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Real::getTypeName() const
|
||||
{
|
||||
return "real";
|
||||
}
|
||||
|
||||
std::string
|
||||
QPDF_Real::getVal()
|
||||
{
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
QPDF_Reserved::QPDF_Reserved() :
|
||||
QPDFValue(::ot_reserved, "reserved")
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<QPDFObject>
|
||||
QPDF_Reserved::create()
|
||||
{
|
||||
@ -29,15 +34,3 @@ QPDF_Reserved::getJSON(int json_version)
|
||||
"QPDFObjectHandle: attempting to unparse a reserved object");
|
||||
return JSON::makeNull();
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Reserved::getTypeCode() const
|
||||
{
|
||||
return ::ot_reserved;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Reserved::getTypeName() const
|
||||
{
|
||||
return "reserved";
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ QPDF_Stream::QPDF_Stream(
|
||||
QPDFObjectHandle stream_dict,
|
||||
qpdf_offset_t offset,
|
||||
size_t length) :
|
||||
QPDFValue(::ot_stream, "stream"),
|
||||
qpdf(qpdf),
|
||||
og(og),
|
||||
filter_on_write(true),
|
||||
@ -291,18 +292,6 @@ QPDF_Stream::getStreamJSON(
|
||||
return result;
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Stream::getTypeCode() const
|
||||
{
|
||||
return ::ot_stream;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Stream::getTypeName() const
|
||||
{
|
||||
return "stream";
|
||||
}
|
||||
|
||||
void
|
||||
QPDF_Stream::setDescription(QPDF* qpdf, std::string const& description)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ is_iso_latin1_printable(char ch)
|
||||
}
|
||||
|
||||
QPDF_String::QPDF_String(std::string const& val) :
|
||||
QPDFValue(::ot_string, "string"),
|
||||
val(val)
|
||||
{
|
||||
}
|
||||
@ -84,18 +85,6 @@ QPDF_String::getJSON(int json_version)
|
||||
return JSON::makeString(result);
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_String::getTypeCode() const
|
||||
{
|
||||
return ::ot_string;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_String::getTypeName() const
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
|
||||
bool
|
||||
QPDF_String::useHexString() const
|
||||
{
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
QPDF_Unresolved::QPDF_Unresolved() :
|
||||
QPDFValue(::ot_unresolved, "unresolved")
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<QPDFObject>
|
||||
QPDF_Unresolved::create()
|
||||
{
|
||||
@ -27,15 +32,3 @@ QPDF_Unresolved::getJSON(int json_version)
|
||||
{
|
||||
return JSON::makeNull();
|
||||
}
|
||||
|
||||
qpdf_object_type_e
|
||||
QPDF_Unresolved::getTypeCode() const
|
||||
{
|
||||
return ::ot_unresolved;
|
||||
}
|
||||
|
||||
char const*
|
||||
QPDF_Unresolved::getTypeName() const
|
||||
{
|
||||
return "unresolved";
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ class QPDF_Array: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
|
||||
int getNItems() const;
|
||||
QPDFObjectHandle getItem(int n) const;
|
||||
|
@ -11,8 +11,6 @@ class QPDF_Bool: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
bool getVal() const;
|
||||
|
||||
private:
|
||||
|
@ -17,8 +17,6 @@ class QPDF_Dictionary: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
|
||||
// hasKey() and getKeys() treat keys with null values as if they
|
||||
// aren't there. getKey() returns null for the value of a
|
||||
|
@ -11,8 +11,6 @@ class QPDF_InlineImage: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
std::string getVal() const;
|
||||
|
||||
private:
|
||||
|
@ -11,8 +11,6 @@ class QPDF_Integer: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
long long getVal() const;
|
||||
|
||||
private:
|
||||
|
@ -11,8 +11,6 @@ class QPDF_Name: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
std::string getName() const;
|
||||
|
||||
// Put # into strings with characters unsuitable for name token
|
||||
|
@ -11,11 +11,9 @@ class QPDF_Null: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
|
||||
private:
|
||||
QPDF_Null() = default;
|
||||
QPDF_Null();
|
||||
};
|
||||
|
||||
#endif // QPDF_NULL_HH
|
||||
|
@ -11,8 +11,6 @@ class QPDF_Operator: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
std::string getVal() const;
|
||||
|
||||
private:
|
||||
|
@ -13,8 +13,6 @@ class QPDF_Real: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
std::string getVal();
|
||||
|
||||
private:
|
||||
|
@ -11,11 +11,9 @@ class QPDF_Reserved: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
|
||||
private:
|
||||
QPDF_Reserved() = default;
|
||||
QPDF_Reserved();
|
||||
};
|
||||
|
||||
#endif // QPDF_RESERVED_HH
|
||||
|
@ -26,8 +26,6 @@ class QPDF_Stream: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
virtual void setDescription(QPDF*, std::string const&);
|
||||
QPDFObjectHandle getDict() const;
|
||||
bool isDataModified() const;
|
||||
|
@ -16,8 +16,6 @@ class QPDF_String: public QPDFValue
|
||||
create_utf16(std::string const& utf8_val);
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
std::string unparse(bool force_binary);
|
||||
virtual JSON getJSON(int json_version);
|
||||
std::string getVal() const;
|
||||
|
@ -11,11 +11,9 @@ class QPDF_Unresolved: public QPDFValue
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy();
|
||||
virtual std::string unparse();
|
||||
virtual JSON getJSON(int json_version);
|
||||
virtual qpdf_object_type_e getTypeCode() const;
|
||||
virtual char const* getTypeName() const;
|
||||
|
||||
private:
|
||||
QPDF_Unresolved() = default;
|
||||
QPDF_Unresolved();
|
||||
};
|
||||
|
||||
#endif // QPDF_UNRESOLVED_HH
|
||||
|
Loading…
x
Reference in New Issue
Block a user