diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-12-20 20:41:44 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-12-20 20:51:45 +0100 |
commit | d866f480813169208efba0e4f32ecde4a5b54ebc (patch) | |
tree | 593a93d99ec00e361fbbd51c1054950cfd5491f5 /include | |
parent | cf7b2b5700de735f6db6904d001db598bfb947af (diff) | |
download | qpdf-d866f480813169208efba0e4f32ecde4a5b54ebc.tar.zst |
Change names of qpdf_object_type_e enumerations
They have to be ot_* rather than qpdf_ot_* for compatibility.
* Different enumerated types are not assignment-compatible in C++, at
least with strict compiler settings
* While you can do `constexpr ot_xyz = ::qpdf_ot_xyz` in QPDFObject.hh to
make QPDFObject::ot_xyz work, QPDFObject::object_type_e::ot_xyz will
only work if the enumerated type names are the same.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/Constants.h | 32 | ||||
-rw-r--r-- | include/qpdf/QPDFObject.hh | 26 |
2 files changed, 31 insertions, 27 deletions
diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h index 3e36a8f9..fab6e370 100644 --- a/include/qpdf/Constants.h +++ b/include/qpdf/Constants.h @@ -47,25 +47,29 @@ enum qpdf_error_code_e * qpdf_oh, have 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. + * should take that into consideration. (Maintainer note: it would be + * better to call this qpdf_ot_* rather than ot_* to reduce likelihood + * of name collision, but since QPDFObject::object_type_e is an alias + * to this type, changing the names of the values breaks backward + * compatibility.) */ enum qpdf_object_type_e { /* Object types internal to qpdf */ - qpdf_ot_uninitialized, - qpdf_ot_reserved, + ot_uninitialized, + ot_reserved, /* Object types that can occur in the main document */ - qpdf_ot_null, - qpdf_ot_boolean, - qpdf_ot_integer, - qpdf_ot_real, - qpdf_ot_string, - qpdf_ot_name, - qpdf_ot_array, - qpdf_ot_dictionary, - qpdf_ot_stream, + ot_null, + ot_boolean, + ot_integer, + ot_real, + ot_string, + ot_name, + ot_array, + ot_dictionary, + ot_stream, /* Additional object types that can occur in content streams */ - qpdf_ot_operator, - qpdf_ot_inlineimage, + ot_operator, + ot_inlineimage, /* NOTE: if adding to this list, update QPDFObject.hh */ }; diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index 02f51ab2..2e86a1f8 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -48,19 +48,19 @@ class QPDF_DLL_CLASS QPDFObject // QPDFObject::object_type_e but was moved to make it accessible // to the C API. The code below is for backward compatibility. typedef enum qpdf_object_type_e object_type_e; - static constexpr object_type_e ot_uninitialized = ::qpdf_ot_uninitialized; - static constexpr object_type_e ot_reserved = ::qpdf_ot_reserved; - static constexpr object_type_e ot_null = ::qpdf_ot_null; - static constexpr object_type_e ot_boolean = ::qpdf_ot_boolean; - static constexpr object_type_e ot_integer = ::qpdf_ot_integer; - static constexpr object_type_e ot_real = ::qpdf_ot_real; - static constexpr object_type_e ot_string = ::qpdf_ot_string; - static constexpr object_type_e ot_name = ::qpdf_ot_name; - static constexpr object_type_e ot_array = ::qpdf_ot_array; - static constexpr object_type_e ot_dictionary = ::qpdf_ot_dictionary; - static constexpr object_type_e ot_stream = ::qpdf_ot_stream; - static constexpr object_type_e ot_operator = ::qpdf_ot_operator; - static constexpr object_type_e ot_inlineimage = ::qpdf_ot_inlineimage; + static constexpr object_type_e ot_uninitialized = ::ot_uninitialized; + static constexpr object_type_e ot_reserved = ::ot_reserved; + static constexpr object_type_e ot_null = ::ot_null; + static constexpr object_type_e ot_boolean = ::ot_boolean; + static constexpr object_type_e ot_integer = ::ot_integer; + static constexpr object_type_e ot_real = ::ot_real; + static constexpr object_type_e ot_string = ::ot_string; + static constexpr object_type_e ot_name = ::ot_name; + static constexpr object_type_e ot_array = ::ot_array; + static constexpr object_type_e ot_dictionary = ::ot_dictionary; + static constexpr object_type_e ot_stream = ::ot_stream; + static constexpr object_type_e ot_operator = ::ot_operator; + static constexpr object_type_e ot_inlineimage = ::ot_inlineimage; virtual ~QPDFObject() {} virtual std::string unparse() = 0; |