mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +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>
|
||||
|
||||
* 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
|
||||
interfaces. Clarify documentation regarding object accessors and
|
||||
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
|
||||
// handle the case of pages whose contents are split across
|
||||
// multiple streams.
|
||||
QPDF_DLL
|
||||
void addTokenFilter(PointerHolder<TokenFilter> token_filter);
|
||||
|
||||
// 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;
|
||||
ParserCallbacks cb;
|
||||
fx1.parseContents(&cb);
|
||||
Pl_Buffer b("buffer");
|
||||
fx1.addContentTokenFilter(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);
|
||||
// Do this once with addContentTokenFilter and once with
|
||||
// addTokenFilter to show that they are the same and to ensure
|
||||
// that addTokenFilter is directly exercised in testing.
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Pl_Buffer b("buffer");
|
||||
if (i == 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user