From 12f1eb15ca3fed6310402847559a7c99d3c77847 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 2 Apr 2022 17:14:10 -0400 Subject: 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 --- examples/qpdf-job.cc | 50 +++++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'examples/qpdf-job.cc') diff --git a/examples/qpdf-job.cc b/examples/qpdf-job.cc index ecebca3b..b71b612a 100644 --- a/examples/qpdf-job.cc +++ b/examples/qpdf-job.cc @@ -1,34 +1,32 @@ +#include #include #include -#include -#include #include +#include // This program is a simple demonstration of different ways to use the // QPDFJob API. static char const* whoami = 0; -static void usage() +static void +usage() { - std::cerr - << "Usage: " << whoami << std::endl - << "This program linearizes the first page of in.pdf to out1.pdf," - << " out2.pdf, and" - << std::endl - << " out3.pdf, each demonstrating a different way to use the" - << " QPDFJob API" - << std::endl; + std::cerr << "Usage: " << whoami << std::endl + << "This program linearizes the first page of in.pdf to out1.pdf," + << " out2.pdf, and" << std::endl + << " out3.pdf, each demonstrating a different way to use the" + << " QPDFJob API" << std::endl; exit(2); } -int main(int argc, char* argv[]) +int +main(int argc, char* argv[]) { whoami = QUtil::getWhoami(argv[0]); - if (argc != 1) - { + if (argc != 1) { usage(); } @@ -39,8 +37,7 @@ int main(int argc, char* argv[]) // Note that staticId is used for testing only. - try - { + try { // Use the config API QPDFJob j; j.config() @@ -54,15 +51,12 @@ int main(int argc, char* argv[]) ->checkConfiguration(); j.run(); std::cout << "out1 status: " << j.getExitCode() << std::endl; - } - catch (std::exception& e) - { + } catch (std::exception& e) { std::cerr << "exception: " << e.what() << std::endl; return 2; } - try - { + try { char const* new_argv[] = { whoami, "in.pdf", @@ -73,21 +67,17 @@ int main(int argc, char* argv[]) "1", "--", "--static-id", - nullptr - }; + nullptr}; QPDFJob j; j.initializeFromArgv(new_argv); j.run(); std::cout << "out2 status: " << j.getExitCode() << std::endl; - } - catch (std::exception& e) - { + } catch (std::exception& e) { std::cerr << "exception: " << e.what() << std::endl; return 2; } - try - { + try { // Use the JSON API QPDFJob j; j.initializeFromJson(R"({ @@ -105,9 +95,7 @@ int main(int argc, char* argv[]) )"); j.run(); std::cout << "out3 status: " << j.getExitCode() << std::endl; - } - catch (std::exception& e) - { + } catch (std::exception& e) { std::cerr << "exception: " << e.what() << std::endl; return 2; } -- cgit v1.2.3-54-g00ecf