From: Joel Rosdahl Date: Wed, 1 Mar 2023 18:06:26 +0000 (+0100) Subject: enhance: Add util::TextTable::Cell::Cell(std::string_view) X-Git-Tag: v4.8~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32e35fc80784adbbfe6d35c001b1e6c36a599aaa;p=thirdparty%2Fccache.git enhance: Add util::TextTable::Cell::Cell(std::string_view) --- diff --git a/src/util/TextTable.cpp b/src/util/TextTable.cpp index 53014aa4e..c7fd17f22 100644 --- a/src/util/TextTable.cpp +++ b/src/util/TextTable.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Joel Rosdahl and other contributors +// Copyright (C) 2021-2023 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -115,9 +115,11 @@ TextTable::render() const return result; } -TextTable::Cell::Cell(const std::string& text) - : m_text(text), - m_right_align(false) +TextTable::Cell::Cell(const std::string& text) : m_text(text) +{ +} + +TextTable::Cell::Cell(std::string_view text) : Cell(std::string(text)) { } diff --git a/src/util/TextTable.hpp b/src/util/TextTable.hpp index 60edee75b..d435603f0 100644 --- a/src/util/TextTable.hpp +++ b/src/util/TextTable.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2021-2022 Joel Rosdahl and other contributors +// Copyright (C) 2021-2023 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -20,6 +20,7 @@ #include #include +#include #include namespace util { @@ -31,6 +32,7 @@ public: { public: Cell(const std::string& text); + Cell(std::string_view text); Cell(const char* text); Cell(uint64_t number);