]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
enhance: Add util::TextTable::Cell::Cell(std::string_view)
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Mar 2023 18:06:26 +0000 (19:06 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 4 Mar 2023 09:10:21 +0000 (10:10 +0100)
src/util/TextTable.cpp
src/util/TextTable.hpp

index 53014aa4efbeb053f5c7c6e51a87dd150a6e490c..c7fd17f22dc5f4a343a21d3f83c50ee39e7f462f 100644 (file)
@@ -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))
 {
 }
 
index 60edee75b416bdeea2d73233c0a39d7c71bbdb5d..d435603f04fe96956ba18a910de1c348c9531181 100644 (file)
@@ -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 <cstdint>
 #include <string>
+#include <string_view>
 #include <vector>
 
 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);