From bfda71774907263f5263a3ae2e8c8fa40fbc2cca Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 23 Jan 2013 09:38:05 -0500 Subject: Cosmetic changes to be closer to Adobe terminology Change object type Keyword to Operator, and place the order of the object types in object_type_e in the same order as they are mentioned in the PDF specification. Note that this change only breaks backward compatibility with code that has not yet been released. --- libqpdf/QPDFObjectHandle.cc | 28 ++++++++++++++-------------- libqpdf/QPDF_Keyword.cc | 36 ------------------------------------ libqpdf/QPDF_Operator.cc | 36 ++++++++++++++++++++++++++++++++++++ libqpdf/build.mk | 2 +- libqpdf/qpdf/QPDF_Keyword.hh | 20 -------------------- libqpdf/qpdf/QPDF_Operator.hh | 20 ++++++++++++++++++++ 6 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 libqpdf/QPDF_Keyword.cc create mode 100644 libqpdf/QPDF_Operator.cc delete mode 100644 libqpdf/qpdf/QPDF_Keyword.hh create mode 100644 libqpdf/qpdf/QPDF_Operator.hh (limited to 'libqpdf') diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index b53dd577..fca8191d 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -180,10 +180,10 @@ QPDFObjectHandle::isString() } bool -QPDFObjectHandle::isKeyword() +QPDFObjectHandle::isOperator() { dereference(); - return QPDFObjectTypeAccessor::check(obj.getPointer()); + return QPDFObjectTypeAccessor::check(obj.getPointer()); } bool @@ -233,7 +233,7 @@ bool QPDFObjectHandle::isScalar() { return (! (isArray() || isDictionary() || isStream() || - isKeyword() || isInlineImage())); + isOperator() || isInlineImage())); } // Bool accessors @@ -288,13 +288,13 @@ QPDFObjectHandle::getUTF8Value() return dynamic_cast(obj.getPointer())->getUTF8Val(); } -// Keyword and Inline Image accessors +// Operator and Inline Image accessors std::string -QPDFObjectHandle::getKeywordValue() +QPDFObjectHandle::getOperatorValue() { - assertKeyword(); - return dynamic_cast(obj.getPointer())->getVal(); + assertOperator(); + return dynamic_cast(obj.getPointer())->getVal(); } std::string @@ -760,7 +760,7 @@ QPDFObjectHandle::parseContentStream_internal(QPDFObjectHandle stream, } callbacks->handleObject(obj); - if (obj.isKeyword() && (obj.getKeywordValue() == "ID")) + if (obj.isOperator() && (obj.getOperatorValue() == "ID")) { // Discard next character; it is the space after ID that // terminated the token. Read until end of inline image. @@ -970,7 +970,7 @@ QPDFObjectHandle::parseInternal(PointerHolder input, } else if (content_stream) { - object = QPDFObjectHandle::newKeyword(token.getValue()); + object = QPDFObjectHandle::newOperator(token.getValue()); } else { @@ -1108,9 +1108,9 @@ QPDFObjectHandle::newString(std::string const& str) } QPDFObjectHandle -QPDFObjectHandle::newKeyword(std::string const& value) +QPDFObjectHandle::newOperator(std::string const& value) { - return QPDFObjectHandle(new QPDF_Keyword(value)); + return QPDFObjectHandle(new QPDF_Operator(value)); } QPDFObjectHandle @@ -1404,9 +1404,9 @@ QPDFObjectHandle::assertString() } void -QPDFObjectHandle::assertKeyword() +QPDFObjectHandle::assertOperator() { - assertType("Keyword", isKeyword()); + assertType("Operator", isOperator()); } void diff --git a/libqpdf/QPDF_Keyword.cc b/libqpdf/QPDF_Keyword.cc deleted file mode 100644 index f55088e2..00000000 --- a/libqpdf/QPDF_Keyword.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include - -QPDF_Keyword::QPDF_Keyword(std::string const& val) : - val(val) -{ -} - -QPDF_Keyword::~QPDF_Keyword() -{ -} - -std::string -QPDF_Keyword::unparse() -{ - return this->val; -} - -QPDFObject::object_type_e -QPDF_Keyword::getTypeCode() const -{ - return QPDFObject::ot_keyword; -} - -char const* -QPDF_Keyword::getTypeName() const -{ - return "keyword"; -} - -std::string -QPDF_Keyword::getVal() const -{ - return this->val; -} diff --git a/libqpdf/QPDF_Operator.cc b/libqpdf/QPDF_Operator.cc new file mode 100644 index 00000000..c6c68816 --- /dev/null +++ b/libqpdf/QPDF_Operator.cc @@ -0,0 +1,36 @@ +#include + +#include + +QPDF_Operator::QPDF_Operator(std::string const& val) : + val(val) +{ +} + +QPDF_Operator::~QPDF_Operator() +{ +} + +std::string +QPDF_Operator::unparse() +{ + return this->val; +} + +QPDFObject::object_type_e +QPDF_Operator::getTypeCode() const +{ + return QPDFObject::ot_operator; +} + +char const* +QPDF_Operator::getTypeName() const +{ + return "operator"; +} + +std::string +QPDF_Operator::getVal() const +{ + return this->val; +} diff --git a/libqpdf/build.mk b/libqpdf/build.mk index 0b248a91..16342b9f 100644 --- a/libqpdf/build.mk +++ b/libqpdf/build.mk @@ -43,8 +43,8 @@ SRCS_libqpdf = \ libqpdf/QPDF_InlineImage.cc \ libqpdf/QPDF_Integer.cc \ libqpdf/QPDF_Name.cc \ - libqpdf/QPDF_Keyword.cc \ libqpdf/QPDF_Null.cc \ + libqpdf/QPDF_Operator.cc \ libqpdf/QPDF_Real.cc \ libqpdf/QPDF_Reserved.cc \ libqpdf/QPDF_Stream.cc \ diff --git a/libqpdf/qpdf/QPDF_Keyword.hh b/libqpdf/qpdf/QPDF_Keyword.hh deleted file mode 100644 index 78ae5791..00000000 --- a/libqpdf/qpdf/QPDF_Keyword.hh +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __QPDF_KEYWORD_HH__ -#define __QPDF_KEYWORD_HH__ - -#include - -class QPDF_Keyword: public QPDFObject -{ - public: - QPDF_Keyword(std::string const& val); - virtual ~QPDF_Keyword(); - virtual std::string unparse(); - virtual QPDFObject::object_type_e getTypeCode() const; - virtual char const* getTypeName() const; - std::string getVal() const; - - private: - std::string val; -}; - -#endif // __QPDF_KEYWORD_HH__ diff --git a/libqpdf/qpdf/QPDF_Operator.hh b/libqpdf/qpdf/QPDF_Operator.hh new file mode 100644 index 00000000..9d18ad37 --- /dev/null +++ b/libqpdf/qpdf/QPDF_Operator.hh @@ -0,0 +1,20 @@ +#ifndef __QPDF_OPERATOR_HH__ +#define __QPDF_OPERATOR_HH__ + +#include + +class QPDF_Operator: public QPDFObject +{ + public: + QPDF_Operator(std::string const& val); + virtual ~QPDF_Operator(); + virtual std::string unparse(); + virtual QPDFObject::object_type_e getTypeCode() const; + virtual char const* getTypeName() const; + std::string getVal() const; + + private: + std::string val; +}; + +#endif // __QPDF_OPERATOR_HH__ -- cgit v1.2.3-54-g00ecf