From 7bc0f1d828eccbc5a277b75aedc85b7523919f87 Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 27 May 2023 23:49:18 +0100 Subject: Code tidy - Clang-Tidy rule modernize-use-emplace --- examples/pdf-create.cc | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index c793b5f8..7b44fb7f 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -50,28 +50,28 @@ ImageProvider::ImageProvider(std::string const& color_space, std::string const& { 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 +335,13 @@ create_pdf(char const* filename) ">>"_qpdf); std::vector 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 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) { -- cgit v1.2.3-54-g00ecf