summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2013-01-23 15:38:05 +0100
committerJay Berkenbilt <ejb@ql.org>2013-01-23 15:38:05 +0100
commitbfda71774907263f5263a3ae2e8c8fa40fbc2cca (patch)
tree0861f846c89f67fc18b11793fdb662313c5dfd9e
parent913eb5ac35011b3d28c653b6f89d936c8f99c844 (diff)
downloadqpdf-bfda71774907263f5263a3ae2e8c8fa40fbc2cca.tar.zst
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.
-rw-r--r--ChangeLog2
-rw-r--r--examples/qtest/parse-content/content.out10
-rw-r--r--include/qpdf/QPDFObject.hh6
-rw-r--r--include/qpdf/QPDFObjectHandle.hh10
-rw-r--r--libqpdf/QPDFObjectHandle.cc28
-rw-r--r--libqpdf/QPDF_Keyword.cc36
-rw-r--r--libqpdf/QPDF_Operator.cc36
-rw-r--r--libqpdf/build.mk2
-rw-r--r--libqpdf/qpdf/QPDF_Operator.hh (renamed from libqpdf/qpdf/QPDF_Keyword.hh)12
-rw-r--r--qpdf/qtest/qpdf/eof-in-inline-image.out14
-rw-r--r--qpdf/qtest/qpdf/tokenize-content-streams.out48
11 files changed, 102 insertions, 102 deletions
diff --git a/ChangeLog b/ChangeLog
index cd2ee734..5cbfc738 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,7 +17,7 @@
objects in a content stream and calls handlers in a callback
class. The example pdf-parse-content illustrates it use.
- * Add QPDF_Keyword and QPDF_InlineImage types along with
+ * Add QPDF_Operator and QPDF_InlineImage types along with
appropriate wrapper methods in QPDFObjectHandle. These new object
types are to facilitate content stream parsing.
diff --git a/examples/qtest/parse-content/content.out b/examples/qtest/parse-content/content.out
index dc6bd8d1..b0c041e5 100644
--- a/examples/qtest/parse-content/content.out
+++ b/examples/qtest/parse-content/content.out
@@ -1,11 +1,11 @@
-keyword: BT
+operator: BT
name: /F1
integer: 24
-keyword: Tf
+operator: Tf
integer: 72
integer: 720
-keyword: Td
+operator: Td
string: (Potato)
-keyword: Tj
-keyword: ET
+operator: Tj
+operator: ET
-EOF-
diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh
index 4a5f2dec..d58deb72 100644
--- a/include/qpdf/QPDFObject.hh
+++ b/include/qpdf/QPDFObject.hh
@@ -30,17 +30,17 @@ class QPDFObject
ot_uninitialized,
ot_reserved,
// Object types that can occur in the main document
- ot_boolean,
ot_null,
+ ot_boolean,
ot_integer,
ot_real,
- ot_name,
ot_string,
+ ot_name,
ot_array,
ot_dictionary,
ot_stream,
// Additional object types that can occur in content streams
- ot_keyword,
+ ot_operator,
ot_inlineimage,
};
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index a23d81df..e2c8b529 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -99,7 +99,7 @@ class QPDFObjectHandle
QPDF_DLL
char const* getTypeName() const;
- // Exactly one of these will return true for any object. Keyword
+ // Exactly one of these will return true for any object. Operator
// and InlineImage are only allowed in content streams.
QPDF_DLL
bool isBool();
@@ -114,7 +114,7 @@ class QPDFObjectHandle
QPDF_DLL
bool isString();
QPDF_DLL
- bool isKeyword();
+ bool isOperator();
QPDF_DLL
bool isInlineImage();
QPDF_DLL
@@ -182,7 +182,7 @@ class QPDFObjectHandle
QPDF_DLL
static QPDFObjectHandle newString(std::string const& str);
QPDF_DLL
- static QPDFObjectHandle newKeyword(std::string const&);
+ static QPDFObjectHandle newOperator(std::string const&);
QPDF_DLL
static QPDFObjectHandle newInlineImage(std::string const&);
QPDF_DLL
@@ -279,7 +279,7 @@ class QPDFObjectHandle
// Methods for content stream objects
QPDF_DLL
- std::string getKeywordValue();
+ std::string getOperatorValue();
QPDF_DLL
std::string getInlineImageValue();
@@ -554,7 +554,7 @@ class QPDFObjectHandle
QPDF_DLL
void assertString();
QPDF_DLL
- void assertKeyword();
+ void assertOperator();
QPDF_DLL
void assertInlineImage();
QPDF_DLL
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 <qpdf/QPDF_Real.hh>
#include <qpdf/QPDF_Name.hh>
#include <qpdf/QPDF_String.hh>
-#include <qpdf/QPDF_Keyword.hh>
+#include <qpdf/QPDF_Operator.hh>
#include <qpdf/QPDF_InlineImage.hh>
#include <qpdf/QPDF_Array.hh>
#include <qpdf/QPDF_Dictionary.hh>
@@ -180,10 +180,10 @@ QPDFObjectHandle::isString()
}
bool
-QPDFObjectHandle::isKeyword()
+QPDFObjectHandle::isOperator()
{
dereference();
- return QPDFObjectTypeAccessor<QPDF_Keyword>::check(obj.getPointer());
+ return QPDFObjectTypeAccessor<QPDF_Operator>::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<QPDF_String*>(obj.getPointer())->getUTF8Val();
}
-// Keyword and Inline Image accessors
+// Operator and Inline Image accessors
std::string
-QPDFObjectHandle::getKeywordValue()
+QPDFObjectHandle::getOperatorValue()
{
- assertKeyword();
- return dynamic_cast<QPDF_Keyword*>(obj.getPointer())->getVal();
+ assertOperator();
+ return dynamic_cast<QPDF_Operator*>(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<InputSource> 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 <qpdf/QPDF_Keyword.hh>
-
-#include <qpdf/QUtil.hh>
-
-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 <qpdf/QPDF_Operator.hh>
+
+#include <qpdf/QUtil.hh>
+
+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_Operator.hh
index 78ae5791..9d18ad37 100644
--- a/libqpdf/qpdf/QPDF_Keyword.hh
+++ b/libqpdf/qpdf/QPDF_Operator.hh
@@ -1,13 +1,13 @@
-#ifndef __QPDF_KEYWORD_HH__
-#define __QPDF_KEYWORD_HH__
+#ifndef __QPDF_OPERATOR_HH__
+#define __QPDF_OPERATOR_HH__
#include <qpdf/QPDFObject.hh>
-class QPDF_Keyword: public QPDFObject
+class QPDF_Operator: public QPDFObject
{
public:
- QPDF_Keyword(std::string const& val);
- virtual ~QPDF_Keyword();
+ 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;
@@ -17,4 +17,4 @@ class QPDF_Keyword: public QPDFObject
std::string val;
};
-#endif // __QPDF_KEYWORD_HH__
+#endif // __QPDF_OPERATOR_HH__
diff --git a/qpdf/qtest/qpdf/eof-in-inline-image.out b/qpdf/qtest/qpdf/eof-in-inline-image.out
index 6fa0cfe1..d78c072b 100644
--- a/qpdf/qtest/qpdf/eof-in-inline-image.out
+++ b/qpdf/qtest/qpdf/eof-in-inline-image.out
@@ -1,14 +1,14 @@
-keyword: BT
+operator: BT
name: /F1
integer: 24
-keyword: Tf
+operator: Tf
integer: 72
integer: 720
-keyword: Td
+operator: Td
string: (Potato)
-keyword: Tj
-keyword: ET
-keyword: BI
+operator: Tj
+operator: ET
+operator: BI
name: /CS
name: /G
name: /W
@@ -21,5 +21,5 @@ name: /F
name: /Fl
name: /DP
dictionary: << /Columns 1 /Predictor 15 >>
-keyword: ID
+operator: ID
content stream object 4 0 (stream data, file position 139): EOF found while reading inline image
diff --git a/qpdf/qtest/qpdf/tokenize-content-streams.out b/qpdf/qtest/qpdf/tokenize-content-streams.out
index 31813861..fbc81d1c 100644
--- a/qpdf/qtest/qpdf/tokenize-content-streams.out
+++ b/qpdf/qtest/qpdf/tokenize-content-streams.out
@@ -1,13 +1,13 @@
-keyword: BT
+operator: BT
name: /F1
integer: 24
-keyword: Tf
+operator: Tf
integer: 72
integer: 720
-keyword: Td
+operator: Td
string: (Potato)
-keyword: Tj
-keyword: ET
+operator: Tj
+operator: ET
-EOF-
real: 0.1
integer: 0
@@ -15,16 +15,16 @@ integer: 0
real: 0.1
integer: 0
integer: 0
-keyword: cm
-keyword: q
+operator: cm
+operator: q
integer: 0
real: 1.1999
real: -1.1999
integer: 0
real: 121.19
real: 150.009
-keyword: cm
-keyword: BI
+operator: cm
+operator: BI
name: /CS
name: /G
name: /W
@@ -37,19 +37,19 @@ name: /F
name: /Fl
name: /DP
dictionary: << /Columns 1 /Predictor 15 >>
-keyword: ID
+operator: ID
inline-image: 789c63fc0f0001030101
-keyword: EI
-keyword: Q
-keyword: q
+operator: EI
+operator: Q
+operator: q
integer: 0
real: 35.997
real: -128.389
integer: 0
real: 431.964
real: 7269.02
-keyword: cm
-keyword: BI
+operator: cm
+operator: BI
name: /CS
name: /G
name: /W
@@ -62,19 +62,19 @@ name: /F
name: /Fl
name: /DP
dictionary: << /Columns 30 /Predictor 15 >>
-keyword: ID
+operator: ID
inline-image: 789cedd1a11100300800b1b2ffd06503148283bc8dfcf8af2a306ee352eff2e06318638c31c63b3801627b620a
-keyword: EI
-keyword: Q
-keyword: q
+operator: EI
+operator: Q
+operator: q
integer: 0
real: 38.3968
real: -93.5922
integer: 0
real: 431.964
real: 7567.79
-keyword: cm
-keyword: BI
+operator: cm
+operator: BI
name: /CS
name: /G
name: /W
@@ -87,9 +87,9 @@ name: /F
name: /Fl
name: /DP
dictionary: << /Columns 32 /Predictor 15 >>
-keyword: ID
+operator: ID
inline-image: 789c63fccf801f308e2a185530aa60882a20203faa605401890a0643aa1e5530aa6054010d140000bdd03c13
-keyword: EI
-keyword: Q
+operator: EI
+operator: Q
-EOF-
test 37 done