aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-07-16 12:21:11 +0200
committerm-holger <m-holger@kubitscheck.org>2022-07-24 16:41:48 +0200
commiteeb6162f7620fba49bb141ccd2c715cd829c8e24 (patch)
tree60869241401c5c4c673a54f1e00360bbf02a4542 /libqpdf/QPDFObjectHandle.cc
parent6f1041afb8e6d1f57169cd4c79f42a7c1ce94da8 (diff)
downloadqpdf-eeb6162f7620fba49bb141ccd2c715cd829c8e24.tar.zst
Add optional parameter separator to QPDFObjGen::unparse
Also, revert inlining of unparse and operator << from commit 4c6640c in order to avoid exposing QUtil.
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r--libqpdf/QPDFObjectHandle.cc31
1 files changed, 12 insertions, 19 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 66087dd4..b01deb6a 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -103,9 +103,8 @@ void
CoalesceProvider::provideStreamData(int, int, Pipeline* p)
{
QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data");
- std::string description = "page object " +
- QUtil::int_to_string(containing_page.getObjectID()) + " " +
- QUtil::int_to_string(containing_page.getGeneration());
+ std::string description =
+ "page object " + containing_page.getObjGen().unparse(' ');
std::string all_description;
old_contents.pipeContentStreams(p, description, all_description);
}
@@ -1485,13 +1484,6 @@ QPDFObjectHandle::getObjGen() const
return QPDFObjGen(this->objid, this->generation);
}
-std::string
-QPDFObjectHandle::getObjGenAsStr() const
-{
- return QUtil::int_to_string(this->objid) + " " +
- QUtil::int_to_string(this->generation);
-}
-
int
QPDFObjectHandle::getObjectID() const
{
@@ -1556,7 +1548,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray(
} else {
all_description += ",";
}
- all_description += " stream " + item.getObjGenAsStr();
+ all_description += " stream " + item.getObjGen().unparse(' ');
}
return result;
@@ -1565,7 +1557,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray(
std::vector<QPDFObjectHandle>
QPDFObjectHandle::getPageContents()
{
- std::string description = "page object " + getObjGenAsStr();
+ std::string description = "page object " + getObjGen().unparse(' ');
std::string all_description;
return this->getKey("/Contents")
.arrayOrStreamToStreamArray(description, all_description);
@@ -1674,7 +1666,7 @@ QPDFObjectHandle::unparse()
{
std::string result;
if (this->isIndirect()) {
- result = getObjGenAsStr() + " R";
+ result = getObjGen().unparse(' ') + " R";
} else {
result = unparseResolved();
}
@@ -1789,7 +1781,7 @@ QPDFObjectHandle::parse(
void
QPDFObjectHandle::pipePageContents(Pipeline* p)
{
- std::string description = "page object " + getObjGenAsStr();
+ std::string description = "page object " + getObjGen().unparse(' ');
std::string all_description;
this->getKey("/Contents")
.pipeContentStreams(p, description, all_description);
@@ -1813,7 +1805,7 @@ QPDFObjectHandle::pipeContentStreams(
throw QPDFExc(
qpdf_e_damaged_pdf,
"content stream",
- "content stream object " + stream.getObjGenAsStr(),
+ "content stream object " + stream.getObjGen().unparse(' '),
0,
"errors while decoding content stream");
}
@@ -1829,7 +1821,7 @@ QPDFObjectHandle::pipeContentStreams(
void
QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks)
{
- std::string description = "page object " + getObjGenAsStr();
+ std::string description = "page object " + getObjGen().unparse(' ');
this->getKey("/Contents")
.parseContentStream_internal(description, callbacks);
}
@@ -1837,14 +1829,15 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks)
void
QPDFObjectHandle::parseAsContents(ParserCallbacks* callbacks)
{
- std::string description = "object " + getObjGenAsStr();
+ std::string description = "object " + getObjGen().unparse(' ');
this->parseContentStream_internal(description, callbacks);
}
void
QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next)
{
- auto description = "token filter for page object " + getObjGenAsStr();
+ auto description =
+ "token filter for page object " + getObjGen().unparse(' ');
Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next);
this->pipePageContents(&token_pipeline);
}
@@ -1852,7 +1845,7 @@ QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next)
void
QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next)
{
- auto description = "token filter for object " + getObjGenAsStr();
+ auto description = "token filter for object " + getObjGen().unparse(' ');
Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next);
this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized);
}