summaryrefslogtreecommitdiffstats
path: root/examples/pdf-create.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <jberkenbilt@users.noreply.github.com>2023-06-17 17:29:21 +0200
committerGitHub <noreply@github.com>2023-06-17 17:29:21 +0200
commit0b538ec8779a81d499865a82ffcb4f02f4471743 (patch)
tree897778e1d6d1d9070a8327db60f5bc5dbfae8a42 /examples/pdf-create.cc
parent21612165c6c1b49b88786c0232215f2e894254ea (diff)
parentd784e8033c0aafce9becf720dfedf1872c74983e (diff)
downloadqpdf-0b538ec8779a81d499865a82ffcb4f02f4471743.tar.zst
Merge pull request #982 from m-holger/cltidy
Apply various Clang-Tidy rules
Diffstat (limited to 'examples/pdf-create.cc')
-rw-r--r--examples/pdf-create.cc62
1 files changed, 29 insertions, 33 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index c793b5f8..136643d1 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -31,47 +31,43 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider
size_t getHeight() const;
private:
- size_t width;
- size_t stripe_height;
+ size_t width{400};
+ size_t stripe_height{80};
std::string color_space;
std::string filter;
- size_t n_stripes;
+ size_t n_stripes{6};
std::vector<std::string> stripes;
- J_COLOR_SPACE j_color_space;
+ J_COLOR_SPACE j_color_space{JCS_UNKNOWN};
};
ImageProvider::ImageProvider(std::string const& color_space, std::string const& filter) :
- width(400),
- stripe_height(80),
color_space(color_space),
- filter(filter),
- n_stripes(6),
- j_color_space(JCS_UNKNOWN)
+ filter(filter)
{
if (color_space == "/DeviceCMYK") {
j_color_space = JCS_CMYK;
- stripes.push_back(std::string("\xff\x00\x00\x00", 4));
- stripes.push_back(std::string("\x00\xff\x00\x00", 4));
- stripes.push_back(std::string("\x00\x00\xff\x00", 4));
- stripes.push_back(std::string("\xff\x00\xff\x00", 4));
- stripes.push_back(std::string("\xff\xff\x00\x00", 4));
- stripes.push_back(std::string("\x00\x00\x00\xff", 4));
+ stripes.emplace_back("\xff\x00\x00\x00", 4);
+ stripes.emplace_back("\x00\xff\x00\x00", 4);
+ stripes.emplace_back("\x00\x00\xff\x00", 4);
+ stripes.emplace_back("\xff\x00\xff\x00", 4);
+ stripes.emplace_back("\xff\xff\x00\x00", 4);
+ stripes.emplace_back("\x00\x00\x00\xff", 4);
} else if (color_space == "/DeviceRGB") {
j_color_space = JCS_RGB;
- stripes.push_back(std::string("\xff\x00\x00", 3));
- stripes.push_back(std::string("\x00\xff\x00", 3));
- stripes.push_back(std::string("\x00\x00\xff", 3));
- stripes.push_back(std::string("\xff\x00\xff", 3));
- stripes.push_back(std::string("\xff\xff\x00", 3));
- stripes.push_back(std::string("\x00\x00\x00", 3));
+ stripes.emplace_back("\xff\x00\x00", 3);
+ stripes.emplace_back("\x00\xff\x00", 3);
+ stripes.emplace_back("\x00\x00\xff", 3);
+ stripes.emplace_back("\xff\x00\xff", 3);
+ stripes.emplace_back("\xff\xff\x00", 3);
+ stripes.emplace_back("\x00\x00\x00", 3);
} else if (color_space == "/DeviceGray") {
j_color_space = JCS_GRAYSCALE;
- stripes.push_back(std::string("\xee", 1));
- stripes.push_back(std::string("\xcc", 1));
- stripes.push_back(std::string("\x99", 1));
- stripes.push_back(std::string("\x66", 1));
- stripes.push_back(std::string("\x33", 1));
- stripes.push_back(std::string("\x00", 1));
+ stripes.emplace_back("\xee", 1);
+ stripes.emplace_back("\xcc", 1);
+ stripes.emplace_back("\x99", 1);
+ stripes.emplace_back("\x66", 1);
+ stripes.emplace_back("\x33", 1);
+ stripes.emplace_back("\x00", 1);
}
}
@@ -335,13 +331,13 @@ create_pdf(char const* filename)
">>"_qpdf);
std::vector<std::string> color_spaces;
- color_spaces.push_back("/DeviceCMYK");
- color_spaces.push_back("/DeviceRGB");
- color_spaces.push_back("/DeviceGray");
+ color_spaces.emplace_back("/DeviceCMYK");
+ color_spaces.emplace_back("/DeviceRGB");
+ color_spaces.emplace_back("/DeviceGray");
std::vector<std::string> filters;
- filters.push_back("null");
- filters.push_back("/DCTDecode");
- filters.push_back("/RunLengthDecode");
+ filters.emplace_back("null");
+ filters.emplace_back("/DCTDecode");
+ filters.emplace_back("/RunLengthDecode");
QPDFPageDocumentHelper dh(pdf);
for (auto const& color_space: color_spaces) {
for (auto const& filter: filters) {