mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Expose QPDFObjectHandle::addTokenFilter (fixes #580)
This commit is contained in:
parent
72c10d8617
commit
8e0b153332
@ -1,5 +1,9 @@
|
|||||||
2021-12-10 Jay Berkenbilt <ejb@ql.org>
|
2021-12-10 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* Add missing QPDF_DLL to QPDFObjectHandle::addTokenFilter so that
|
||||||
|
it is actually accessible as part of the public interface as
|
||||||
|
intended. Fixes #580.
|
||||||
|
|
||||||
* C API: Overhaul how errors are handle the C API's object handle
|
* C API: Overhaul how errors are handle the C API's object handle
|
||||||
interfaces. Clarify documentation regarding object accessors and
|
interfaces. Clarify documentation regarding object accessors and
|
||||||
how type errors and warnings are handled. Many cases that used to
|
how type errors and warnings are handled. Many cases that used to
|
||||||
|
@ -456,6 +456,7 @@ class QPDFObjectHandle
|
|||||||
// be applied to a page object, and which will automatically
|
// be applied to a page object, and which will automatically
|
||||||
// handle the case of pages whose contents are split across
|
// handle the case of pages whose contents are split across
|
||||||
// multiple streams.
|
// multiple streams.
|
||||||
|
QPDF_DLL
|
||||||
void addTokenFilter(PointerHolder<TokenFilter> token_filter);
|
void addTokenFilter(PointerHolder<TokenFilter> token_filter);
|
||||||
|
|
||||||
// Legacy helpers for parsing content streams. These methods are
|
// Legacy helpers for parsing content streams. These methods are
|
||||||
|
@ -2704,14 +2704,27 @@ void runtest(int n, char const* filename1, char const* arg2)
|
|||||||
std::cout << "--- parseContents ---" << std::endl;
|
std::cout << "--- parseContents ---" << std::endl;
|
||||||
ParserCallbacks cb;
|
ParserCallbacks cb;
|
||||||
fx1.parseContents(&cb);
|
fx1.parseContents(&cb);
|
||||||
Pl_Buffer b("buffer");
|
// Do this once with addContentTokenFilter and once with
|
||||||
fx1.addContentTokenFilter(new TokenFilter);
|
// addTokenFilter to show that they are the same and to ensure
|
||||||
fx1.pipeContents(&b);
|
// that addTokenFilter is directly exercised in testing.
|
||||||
std::unique_ptr<Buffer> buf(b.getBuffer());
|
for (int i = 0; i < 2; i++)
|
||||||
std::string s(
|
{
|
||||||
reinterpret_cast<char const*>(buf->getBuffer()),
|
Pl_Buffer b("buffer");
|
||||||
buf->getSize());
|
if (i == 0)
|
||||||
assert(s.find("/bye") != std::string::npos);
|
{
|
||||||
|
fx1.addContentTokenFilter(new TokenFilter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fx1.getObjectHandle().addTokenFilter(new TokenFilter);
|
||||||
|
}
|
||||||
|
fx1.pipeContents(&b);
|
||||||
|
std::unique_ptr<Buffer> buf(b.getBuffer());
|
||||||
|
std::string s(
|
||||||
|
reinterpret_cast<char const*>(buf->getBuffer()),
|
||||||
|
buf->getSize());
|
||||||
|
assert(s.find("/bye") != std::string::npos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (n == 73)
|
else if (n == 73)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user