2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 08:20:53 +00:00
qpdf/qpdf/test_pdf_unicode.cc
Jay Berkenbilt 12f1eb15ca Programmatically apply new formatting to code
Run this:

for i in  **/*.cc **/*.c **/*.h **/*.hh; do
  clang-format < $i >| $i.new && mv $i.new $i
done
2022-04-04 08:10:40 -04:00

39 lines
872 B
C++

#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdlib.h>
#include <string.h>
static char const* whoami = 0;
void
usage()
{
std::cerr << "Usage: " << whoami << " infile" << std::endl;
exit(2);
}
int
main(int argc, char* argv[])
{
if ((whoami = strrchr(argv[0], '/')) == NULL) {
whoami = argv[0];
} else {
++whoami;
}
if (argc != 2) {
usage();
}
char const* infilename = argv[1];
std::list<std::string> lines = QUtil::read_lines_from_file(infilename);
for (std::list<std::string>::iterator iter = lines.begin();
iter != lines.end();
++iter) {
QPDFObjectHandle str = QPDFObjectHandle::newUnicodeString(*iter);
std::cout << str.getUTF8Value() << " // " << str.unparseBinary()
<< std::endl;
}
return 0;
}