mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Lexer: Migrated trim(), trimLeft() and trimRight() from text to Lexer
This commit is contained in:
parent
51def4b12b
commit
182b5427cd
13 changed files with 75 additions and 72 deletions
|
@ -102,7 +102,7 @@ std::string CmdEdit::findValue (
|
|||
found + name.length (),
|
||||
eol - (found + name.length ()));
|
||||
|
||||
return trim (value, "\t ");
|
||||
return Lexer::trim (value, "\t ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ std::string CmdEdit::findMultilineValue (
|
|||
{
|
||||
std::string value = text.substr (start + startMarker.length (),
|
||||
end - (start + startMarker.length ()));
|
||||
return trim (value, "\t ");
|
||||
return Lexer::trim (value, "\t ");
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
@ -150,7 +150,7 @@ std::vector <std::string> CmdEdit::findValues (
|
|||
eol - (found + name.length ()));
|
||||
|
||||
found = eol - 1;
|
||||
results.push_back (trim (value, "\t "));
|
||||
results.push_back (Lexer::trim (value, "\t "));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
auto eol = after.find ("\n", found + 1);
|
||||
if (eol != std::string::npos)
|
||||
{
|
||||
std::string value = trim (after.substr (
|
||||
std::string value = Lexer::trim (after.substr (
|
||||
found,
|
||||
eol - found), "\t ");
|
||||
|
||||
|
@ -659,7 +659,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
}
|
||||
while (annotations.find (name.str ()) != annotations.end ());
|
||||
|
||||
std::string text = trim (value.substr (gap + 4), "\t ");
|
||||
std::string text = Lexer::trim (value.substr (gap + 4), "\t ");
|
||||
annotations.insert (std::make_pair (name.str (), json::decode (text)));
|
||||
}
|
||||
}
|
||||
|
@ -736,8 +736,8 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
auto colon = orphan.find (':');
|
||||
if (colon != std::string::npos)
|
||||
{
|
||||
std::string name = trim (orphan.substr (0, colon), "\t ");
|
||||
std::string value = trim (orphan.substr (colon + 1), "\t ");
|
||||
std::string name = Lexer::trim (orphan.substr (0, colon), "\t ");
|
||||
std::string value = Lexer::trim (orphan.substr (colon + 1), "\t ");
|
||||
|
||||
if (value != "")
|
||||
task.set (name, value);
|
||||
|
|
|
@ -25,14 +25,15 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <CmdUrgency.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <Filter.h>
|
||||
#include <Lexer.h>
|
||||
#include <main.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
#include <CmdUrgency.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
|
@ -72,7 +73,7 @@ int CmdUrgency::execute (std::string& output)
|
|||
{
|
||||
out << format (STRING_CMD_URGENCY_RESULT,
|
||||
task.identifier (),
|
||||
trim (format (task.urgency (), 6, 3)))
|
||||
Lexer::trim (format (task.urgency (), 6, 3)))
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue