2022-06-19 12:56:36 +00:00
|
|
|
#include <qpdf/assert_test.h>
|
|
|
|
|
2022-06-25 12:29:07 +00:00
|
|
|
#include <qpdf/Pl_Base64.hh>
|
2022-06-19 12:56:36 +00:00
|
|
|
#include <qpdf/Pl_Function.hh>
|
|
|
|
#include <qpdf/Pl_String.hh>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
|
|
|
{
|
2022-06-25 12:29:07 +00:00
|
|
|
Pl_Function p1("p1", nullptr, [](unsigned char const* data, size_t len) {
|
|
|
|
std::cout << "p1: " << len << ": " << data << std::endl;
|
|
|
|
});
|
2022-06-19 12:56:36 +00:00
|
|
|
p1.write(reinterpret_cast<unsigned char const*>("potato"), 6);
|
|
|
|
|
|
|
|
std::string s;
|
|
|
|
Pl_String ps("string", nullptr, s);
|
|
|
|
Pl_Base64 b("base64", &ps, Pl_Base64::a_encode);
|
2022-06-25 12:29:07 +00:00
|
|
|
Pl_Function p2("p2", &b, [](unsigned char const* data, size_t len) {
|
|
|
|
std::cout << "p2: " << len << ": " << data << std::endl;
|
|
|
|
});
|
2022-06-19 12:56:36 +00:00
|
|
|
p2.write(reinterpret_cast<unsigned char const*>("salad"), 5);
|
|
|
|
p2.finish();
|
|
|
|
assert(s == "c2FsYWQ=");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|