text: Removed local join/split implementation

This commit is contained in:
Paul Beckingham 2016-12-07 01:14:16 -05:00
parent db0f8d33e1
commit 232d266fb5
11 changed files with 18 additions and 277 deletions

View file

@ -37,6 +37,7 @@
#include <ViewTask.h>
#include <i18n.h>
#include <format.h>
#include <shared.h>
#include <text.h>
#include <main.h>
@ -72,18 +73,15 @@ int CmdCustom::execute (std::string& output)
std::string reportSort = context.config.get ("report." + _keyword + ".sort");
std::string reportFilter = context.config.get ("report." + _keyword + ".filter");
std::vector <std::string> columns;
split (columns, reportColumns, ',');
auto columns = split (reportColumns, ',');
validateReportColumns (columns);
std::vector <std::string> labels;
split (labels, reportLabels, ',');
auto labels = split (reportLabels, ',');
if (columns.size () != labels.size () && labels.size () != 0)
throw format (STRING_CMD_CUSTOM_MISMATCH, _keyword);
std::vector <std::string> sortOrder;
split (sortOrder, reportSort, ',');
auto sortOrder = split (reportSort, ',');
if (sortOrder.size () != 0 &&
sortOrder[0] != "none")
validateSortColumns (sortOrder);

View file

@ -29,7 +29,7 @@
#include <stdlib.h>
#include <Context.h>
#include <i18n.h>
#include <text.h>
#include <shared.h>
extern Context context;
@ -52,9 +52,7 @@ CmdExec::CmdExec ()
////////////////////////////////////////////////////////////////////////////////
int CmdExec::execute (std::string&)
{
std::string command_line;
join (command_line, " ", context.cli2.getWords ());
return system (command_line.c_str ());
return system (join (" ", context.cli2.getWords ()).c_str ());
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -32,6 +32,7 @@
#include <Context.h>
#include <Filter.h>
#include <format.h>
#include <shared.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
@ -147,10 +148,7 @@ int CmdImport::import (const std::string& input)
// { ... }
catch (std::string& e)
{
std::vector <std::string> lines;
split (lines, input, '\n');
for (auto& line : lines)
for (auto& line : split (input, '\n'))
{
if (line.length ())
{

View file

@ -299,8 +299,7 @@ int CmdInfo::execute (std::string& output)
task.getTags (tags);
if (tags.size ())
{
std::string allTags;
join (allTags, " ", tags);
auto allTags = join (" ", tags);
row = view.addRow ();
view.set (row, 0, STRING_COLUMN_LABEL_TAGS);

View file

@ -33,6 +33,7 @@
#include <Filter.h>
#include <main.h>
#include <format.h>
#include <shared.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
@ -215,8 +216,7 @@ int CmdCompletionUDAs::execute (std::string& output)
if (udas.size ())
{
std::sort (udas.begin (), udas.end ());
join (output, "\n", udas);
output += '\n';
output = join ("\n", udas) + '\n';
}
return 0;