From 060787a5db9112902204d5edc95b40f11ab66384 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 6 Dec 2016 07:23:25 -0500 Subject: [PATCH] calc: Migration to libshared --- src/calc.cpp | 3 +- src/commands/CmdBurndown.cpp | 7 ++--- src/text.cpp | 56 ------------------------------------ src/text.h | 6 ---- 4 files changed, 5 insertions(+), 67 deletions(-) diff --git a/src/calc.cpp b/src/calc.cpp index cf50b8695..55a7e4065 100644 --- a/src/calc.cpp +++ b/src/calc.cpp @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include #include #include diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index 5be688997..ad43dd664 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -37,8 +37,8 @@ #include #include #include -#include -#include +#include +#include extern Context context; @@ -212,8 +212,7 @@ Chart::Chart (char type) // Set the title. std::vector words = context.cli2.getWords (); - std::string filter; - join (filter, " ", words); + auto filter = join (" ", words); _title = '(' + filter + ')'; } diff --git a/src/text.cpp b/src/text.cpp index c4b53fa22..0c859aeab 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -377,59 +377,3 @@ void replace_positional ( } //////////////////////////////////////////////////////////////////////////////// -std::string leftJustify (const int input, const int width) -{ - std::stringstream s; - s << input; - std::string output = s.str (); - return output + std::string (width - output.length (), ' '); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string leftJustify (const std::string& input, const int width) -{ - auto len = static_cast (utf8_text_width (input)); - - if (len == width) - return input; - - if (len > width) - return input.substr (0, width); - - return input + std::string (width - utf8_text_width (input), ' '); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string rightJustifyZero (const int input, const int width) -{ - std::stringstream s; - s << std::setw (width) << std::setfill ('0') << input; - return s.str (); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string rightJustify (const int input, const int width) -{ - std::stringstream s; - s << std::setw (width) << std::setfill (' ') << input; - return s.str (); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string rightJustify (const std::string& input, const int width) -{ - auto len = static_cast (utf8_text_width (input)); - - if (len == width) - return input; - - if (len > width) - return input.substr (0, width); - - return ((width > len) - ? std::string (width - len, ' ') - : "") - + input; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/text.h b/src/text.h index 26d6b23d6..dcefa7189 100644 --- a/src/text.h +++ b/src/text.h @@ -48,11 +48,5 @@ int strippedLength (const std::string&); const std::string obfuscateText (const std::string&); void replace_positional (std::string&, const std::string&, const std::string&); -std::string leftJustify (const int, const int); -std::string leftJustify (const std::string&, const int); -std::string rightJustifyZero (const int, const int); -std::string rightJustify (const int, const int); -std::string rightJustify (const std::string&, const int); - #endif ////////////////////////////////////////////////////////////////////////////////