mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Revert "[clang-tidy] Replace push_back with emplace_back"
This reverts commit 897759e4dc
.
This commit is contained in:
parent
ead50d4d6e
commit
e3e158bf6a
6 changed files with 21 additions and 21 deletions
24
src/CLI2.cpp
24
src/CLI2.cpp
|
@ -339,7 +339,7 @@ void CLI2::add (const std::vector <std::string>& arguments)
|
|||
std::vector <A2> replacement {_original_args[0]};
|
||||
|
||||
for (const auto& arg : arguments)
|
||||
replacement.emplace_back(arg, Lexer::Type::word);
|
||||
replacement.push_back (A2 (arg, Lexer::Type::word));
|
||||
|
||||
for (unsigned int i = 1; i < _original_args.size (); ++i)
|
||||
replacement.push_back (_original_args[i]);
|
||||
|
@ -546,7 +546,7 @@ void CLI2::addFilter (const std::string& arg)
|
|||
if (arg.length ())
|
||||
{
|
||||
std::vector <std::string> filter;
|
||||
filter.emplace_back("(");
|
||||
filter.push_back ("(");
|
||||
|
||||
std::string lexeme;
|
||||
Lexer::Type type;
|
||||
|
@ -555,7 +555,7 @@ void CLI2::addFilter (const std::string& arg)
|
|||
while (lex.token (lexeme, type))
|
||||
filter.push_back (lexeme);
|
||||
|
||||
filter.emplace_back(")");
|
||||
filter.push_back (")");
|
||||
add (filter);
|
||||
analyze ();
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ void CLI2::aliasExpansion ()
|
|||
Lexer::Type type;
|
||||
Lexer lex (_aliases[raw]);
|
||||
while (lex.token (lexeme, type))
|
||||
reconstructed.emplace_back(lexeme, type);
|
||||
reconstructed.push_back (A2 (lexeme, type));
|
||||
|
||||
action = true;
|
||||
changes = true;
|
||||
|
@ -833,7 +833,7 @@ void CLI2::aliasExpansion ()
|
|||
Lexer::Type type;
|
||||
Lexer lex (_aliases[i.attribute ("raw")]);
|
||||
while (lex.token (lexeme, type))
|
||||
reconstructedOriginals.emplace_back(lexeme, type);
|
||||
reconstructedOriginals.push_back (A2 (lexeme, type));
|
||||
|
||||
action = true;
|
||||
changes = true;
|
||||
|
@ -1483,7 +1483,7 @@ void CLI2::findIDs ()
|
|||
{
|
||||
changes = true;
|
||||
std::string number = a.attribute ("raw");
|
||||
_id_ranges.emplace_back(number, number);
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
||||
}
|
||||
}
|
||||
else if (a._lextype == Lexer::Type::set)
|
||||
|
@ -1496,9 +1496,9 @@ void CLI2::findIDs ()
|
|||
changes = true;
|
||||
auto hyphen = element.find ("-");
|
||||
if (hyphen != std::string::npos)
|
||||
_id_ranges.emplace_back(element.substr (0, hyphen), element.substr (hyphen + 1));
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
||||
else
|
||||
_id_ranges.emplace_back(element, element);
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (element, element));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1536,7 +1536,7 @@ void CLI2::findIDs ()
|
|||
changes = true;
|
||||
a.unTag ("MODIFICATION");
|
||||
a.tag ("FILTER");
|
||||
_id_ranges.emplace_back(raw, raw);
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (raw, raw));
|
||||
}
|
||||
else if (a._lextype == Lexer::Type::set)
|
||||
{
|
||||
|
@ -1551,9 +1551,9 @@ void CLI2::findIDs ()
|
|||
changes = true;
|
||||
auto hyphen = element.find ("-");
|
||||
if (hyphen != std::string::npos)
|
||||
_id_ranges.emplace_back(element.substr (0, hyphen), element.substr (hyphen + 1));
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (element.substr (0, hyphen), element.substr (hyphen + 1)));
|
||||
else
|
||||
_id_ranges.emplace_back(element, element);
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (element, element));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2047,7 +2047,7 @@ void CLI2::defaultCommand ()
|
|||
|
||||
while (lex.token (lexeme, type))
|
||||
{
|
||||
reconstructedOriginals.emplace_back(lexeme, type);
|
||||
reconstructedOriginals.push_back (A2 (lexeme, type));
|
||||
|
||||
A2 cmd (lexeme, type);
|
||||
cmd.tag ("DEFAULT");
|
||||
|
|
|
@ -122,7 +122,7 @@ void Eval::evaluateInfixExpression (const std::string& e, Variant& v) const
|
|||
std::string token;
|
||||
Lexer::Type type;
|
||||
while (l.token (token, type))
|
||||
tokens.emplace_back(token, type);
|
||||
tokens.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
||||
|
||||
// Parse for syntax checking and operator replacement.
|
||||
if (_debug)
|
||||
|
@ -149,7 +149,7 @@ void Eval::evaluatePostfixExpression (const std::string& e, Variant& v) const
|
|||
std::string token;
|
||||
Lexer::Type type;
|
||||
while (l.token (token, type))
|
||||
tokens.emplace_back(token, type);
|
||||
tokens.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
||||
|
||||
if (_debug)
|
||||
Context::getContext ().debug ("[1;37;42mFILTER[0m Postfix " + dump (tokens));
|
||||
|
|
|
@ -64,7 +64,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
|||
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
|
||||
for (auto& a : Context::getContext ().cli2._args)
|
||||
if (a.hasTag ("FILTER"))
|
||||
precompiled.emplace_back(a.getToken (), a._lextype);
|
||||
precompiled.push_back (std::pair <std::string, Lexer::Type> (a.getToken (), a._lextype));
|
||||
|
||||
if (!precompiled.empty())
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ void Filter::subset (std::vector <Task>& output)
|
|||
std::vector <std::pair <std::string, Lexer::Type>> precompiled;
|
||||
for (auto& a : Context::getContext ().cli2._args)
|
||||
if (a.hasTag ("FILTER"))
|
||||
precompiled.emplace_back(a.getToken (), a._lextype);
|
||||
precompiled.push_back (std::pair <std::string, Lexer::Type> (a.getToken (), a._lextype));
|
||||
|
||||
// Shortcut indicates that only pending.data needs to be loaded.
|
||||
bool shortcut = false;
|
||||
|
|
|
@ -533,7 +533,7 @@ std::vector <std::string>& Hooks::buildHookScriptArgs (std::vector <std::string>
|
|||
Variant v;
|
||||
|
||||
// Hooks API version.
|
||||
args.emplace_back("api:2");
|
||||
args.push_back ("api:2");
|
||||
|
||||
// Command line Taskwarrior was called with.
|
||||
getDOM ("context.args", v);
|
||||
|
|
|
@ -242,7 +242,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
std::vector <std::vector <std::string>> headers;
|
||||
for (unsigned int c = 0; c < _columns.size (); ++c)
|
||||
{
|
||||
headers.emplace_back();
|
||||
headers.push_back (std::vector <std::string> ());
|
||||
_columns[c]->renderHeader (headers[c], widths[c], _sort[c] ? _sort_header : _header);
|
||||
|
||||
if (headers[c].size () > max_lines)
|
||||
|
@ -312,7 +312,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||
|
||||
for (unsigned int c = 0; c < _columns.size (); ++c)
|
||||
{
|
||||
cells.emplace_back();
|
||||
cells.push_back (std::vector <std::string> ());
|
||||
_columns[c]->render (cells[c], data[sequence[s]], widths[c], row_color);
|
||||
|
||||
if (cells[c].size () > max_lines)
|
||||
|
|
|
@ -79,7 +79,7 @@ void sort_projects (
|
|||
|
||||
// if parent does not exist yet: insert into sorted view
|
||||
if (parent_pos == sorted.end ())
|
||||
sorted.emplace_back (parent, 1);
|
||||
sorted.push_back (std::make_pair (parent, 1));
|
||||
}
|
||||
|
||||
// insert new element below latest parent
|
||||
|
@ -88,7 +88,7 @@ void sort_projects (
|
|||
else
|
||||
{
|
||||
// if has no parents: simply push to end of list
|
||||
sorted.emplace_back(project);
|
||||
sorted.push_back (project);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue