mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
C++11: N1984 auto
This commit is contained in:
parent
7bbc794d3a
commit
e8d04bdce6
24 changed files with 77 additions and 77 deletions
14
src/CLI.cpp
14
src/CLI.cpp
|
@ -230,7 +230,7 @@ void CLI::getOverride (int argc, const char** argv, std::string& home, File& rc)
|
|||
rc = raw.substr (3);
|
||||
|
||||
home = ".";
|
||||
std::string::size_type last_slash = rc._data.rfind ("/");
|
||||
auto last_slash = rc._data.rfind ("/");
|
||||
if (last_slash != std::string::npos)
|
||||
home = rc.parent ();
|
||||
|
||||
|
@ -286,7 +286,7 @@ void CLI::applyOverrides (int argc, const char** argv)
|
|||
raw.length () > 3 &&
|
||||
raw.substr (0, 3) == "rc.")
|
||||
{
|
||||
std::string::size_type sep = raw.find ('=', 3);
|
||||
auto sep = raw.find ('=', 3);
|
||||
if (sep == std::string::npos)
|
||||
sep = raw.find (':', 3);
|
||||
if (sep != std::string::npos)
|
||||
|
@ -445,7 +445,7 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */)
|
|||
a.tag ("BINARY");
|
||||
|
||||
std::string basename = "task";
|
||||
std::string::size_type slash = raw.rfind ('/');
|
||||
auto slash = raw.rfind ('/');
|
||||
if (slash != std::string::npos)
|
||||
basename = raw.substr (slash + 1);
|
||||
|
||||
|
@ -808,7 +808,7 @@ void CLI::findOverrides ()
|
|||
}
|
||||
else if (isConfigOverride (raw))
|
||||
{
|
||||
std::string::size_type sep = raw.find ('=', 3);
|
||||
auto sep = raw.find ('=', 3);
|
||||
if (sep == std::string::npos)
|
||||
sep = raw.find (':', 3);
|
||||
if (sep != std::string::npos)
|
||||
|
@ -2236,8 +2236,8 @@ bool CLI::isSubstitution (const std::string& raw) const
|
|||
// <attr>.[~]<mod>[:=]...
|
||||
bool CLI::isAttribute (const std::string& raw) const
|
||||
{
|
||||
std::string::size_type colon = raw.find (":");
|
||||
std::string::size_type equal = raw.find ("=");
|
||||
auto colon = raw.find (":");
|
||||
auto equal = raw.find ("=");
|
||||
|
||||
std::string attr = "";
|
||||
if (colon != std::string::npos)
|
||||
|
@ -2251,7 +2251,7 @@ bool CLI::isAttribute (const std::string& raw) const
|
|||
if (! isName (attr))
|
||||
return false;
|
||||
|
||||
std::string::size_type dot = attr.find (".");
|
||||
auto dot = attr.find (".");
|
||||
std::string mod = "";
|
||||
if (dot != std::string::npos)
|
||||
{
|
||||
|
|
|
@ -531,7 +531,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
|||
for (auto& line : lines)
|
||||
{
|
||||
// Remove comments.
|
||||
std::string::size_type pound = line.find ("#"); // no i18n
|
||||
auto pound = line.find ("#"); // no i18n
|
||||
if (pound != std::string::npos)
|
||||
line = line.substr (0, pound);
|
||||
|
||||
|
@ -540,7 +540,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
|||
// Skip empty lines.
|
||||
if (line.length () > 0)
|
||||
{
|
||||
std::string::size_type equal = line.find ("="); // no i18n
|
||||
auto equal = line.find ("="); // no i18n
|
||||
if (equal != std::string::npos)
|
||||
{
|
||||
std::string key = trim (line.substr (0, equal), " \t"); // no i18n
|
||||
|
@ -550,7 +550,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string::size_type include = line.find ("include"); // no i18n.
|
||||
auto include = line.find ("include"); // no i18n.
|
||||
if (include != std::string::npos)
|
||||
{
|
||||
Path included (trim (line.substr (include + 7), " \t"));
|
||||
|
@ -575,7 +575,7 @@ void Config::parse (const std::string& input, int nest /* = 1 */)
|
|||
void Config::createDefaultRC (const std::string& rc, const std::string& data)
|
||||
{
|
||||
// Override data.location in the defaults.
|
||||
std::string::size_type loc = _defaults.find ("data.location=~/.task");
|
||||
auto loc = _defaults.find ("data.location=~/.task");
|
||||
// loc+0^ +14^ +21^
|
||||
|
||||
Date now;
|
||||
|
|
|
@ -175,7 +175,7 @@ bool Directory::up ()
|
|||
if (_data == "/")
|
||||
return false;
|
||||
|
||||
std::string::size_type slash = _data.rfind ('/');
|
||||
auto slash = _data.rfind ('/');
|
||||
if (slash == 0)
|
||||
{
|
||||
_data = "/"; // Root dir should retain the slash.
|
||||
|
|
|
@ -299,7 +299,7 @@ std::string Duration::formatISO () const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Duration::parse (const std::string& input, std::string::size_type& start)
|
||||
{
|
||||
std::string::size_type original_start = start;
|
||||
auto original_start = start;
|
||||
Nibbler n (input.substr (start));
|
||||
|
||||
// Static and so preserved between calls.
|
||||
|
|
|
@ -129,7 +129,7 @@ void ISO8601d::ambiguity (bool value)
|
|||
//
|
||||
bool ISO8601d::parse (const std::string& input, std::string::size_type& start)
|
||||
{
|
||||
std::string::size_type i = start;
|
||||
auto i = start;
|
||||
Nibbler n (input.substr (i));
|
||||
|
||||
if (parse_date_time_ext (n) || // Most complex first.
|
||||
|
@ -749,7 +749,7 @@ ISO8601p::operator time_t () const
|
|||
//
|
||||
bool ISO8601p::parse (const std::string& input, std::string::size_type& start)
|
||||
{
|
||||
std::string::size_type i = start;
|
||||
auto i = start;
|
||||
Nibbler n (input.substr (i));
|
||||
|
||||
if (parse_designated (n))
|
||||
|
|
|
@ -150,7 +150,7 @@ bool Msg::parse (const std::string& input)
|
|||
split (lines, input.substr (0, separator), '\n');
|
||||
for (auto& i : lines)
|
||||
{
|
||||
std::string::size_type delimiter = i.find (':');
|
||||
auto delimiter = i.find (':');
|
||||
if (delimiter == std::string::npos)
|
||||
throw std::string ("ERROR: Malformed message header '") + i + "'";
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ bool Nibbler::getUntil (char c, std::string& result)
|
|||
{
|
||||
if (_cursor < _length)
|
||||
{
|
||||
std::string::size_type i = _input.find (c, _cursor);
|
||||
auto i = _input.find (c, _cursor);
|
||||
if (i != std::string::npos)
|
||||
{
|
||||
result = _input.substr (_cursor, i - _cursor);
|
||||
|
@ -114,7 +114,7 @@ bool Nibbler::getUntil (const std::string& terminator, std::string& result)
|
|||
{
|
||||
if (_cursor < _length)
|
||||
{
|
||||
std::string::size_type i = _input.find (terminator, _cursor);
|
||||
auto i = _input.find (terminator, _cursor);
|
||||
if (i != std::string::npos)
|
||||
{
|
||||
result = _input.substr (_cursor, i - _cursor);
|
||||
|
@ -164,7 +164,7 @@ bool Nibbler::getUntilOneOf (const std::string& chars, std::string& result)
|
|||
{
|
||||
if (_cursor < _length)
|
||||
{
|
||||
std::string::size_type i = _input.find_first_of (chars, _cursor);
|
||||
auto i = _input.find_first_of (chars, _cursor);
|
||||
if (i != std::string::npos)
|
||||
{
|
||||
result = _input.substr (_cursor, i - _cursor);
|
||||
|
@ -238,7 +238,7 @@ bool Nibbler::getQuoted (
|
|||
return false;
|
||||
}
|
||||
|
||||
for (std::string::size_type i = _cursor; i < _length; ++i)
|
||||
for (auto i = _cursor; i < _length; ++i)
|
||||
{
|
||||
current = _input[i];
|
||||
|
||||
|
@ -296,7 +296,7 @@ bool Nibbler::getDigit (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getDigit6 (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
if (i < _length &&
|
||||
_length - i >= 6)
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ bool Nibbler::getDigit6 (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getDigit4 (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
if (i < _length &&
|
||||
_length - i >= 4)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ bool Nibbler::getDigit4 (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getDigit3 (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
if (i < _length &&
|
||||
_length - i >= 3)
|
||||
{
|
||||
|
@ -360,7 +360,7 @@ bool Nibbler::getDigit3 (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getDigit2 (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
if (i < _length &&
|
||||
_length - i >= 2)
|
||||
{
|
||||
|
@ -379,7 +379,7 @@ bool Nibbler::getDigit2 (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getInt (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ bool Nibbler::getInt (int& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getUnsignedInt (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
// TODO Potential for use of find_first_not_of
|
||||
while (i < _length && Lexer::isDigit (_input[i]))
|
||||
++i;
|
||||
|
@ -439,7 +439,7 @@ bool Nibbler::getUnsignedInt (int& result)
|
|||
//
|
||||
bool Nibbler::getNumber (std::string& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
// [+-]?
|
||||
if (i < _length && (_input[i] == '-' || _input[i] == '+'))
|
||||
|
@ -525,7 +525,7 @@ bool Nibbler::getNumber (double &result)
|
|||
//
|
||||
bool Nibbler::getUnsignedNumber (double& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
// digit+
|
||||
if (i < _length && Lexer::isDigit (_input[i]))
|
||||
|
@ -619,7 +619,7 @@ bool Nibbler::getRx (const std::string& regex, std::string& result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getUUID (std::string& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length &&
|
||||
_length - i >= 36)
|
||||
|
@ -705,7 +705,7 @@ bool Nibbler::getPartialUUID (std::string& result)
|
|||
// 19980119T070000Z = YYYYMMDDThhmmssZ
|
||||
bool Nibbler::getDateISO (time_t& t)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length &&
|
||||
_length - i >= 16)
|
||||
|
@ -815,7 +815,7 @@ bool Nibbler::parseDigits(std::string::size_type& i,
|
|||
#ifdef NIBBLER_FEATURE_DATE
|
||||
bool Nibbler::getDate (const std::string& format, time_t& t)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
int month = -1; // So we can check later.
|
||||
int day = -1;
|
||||
|
@ -998,7 +998,7 @@ bool Nibbler::getOneOf (
|
|||
// A name is a string of alpha-numeric characters.
|
||||
bool Nibbler::getName (std::string& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length)
|
||||
{
|
||||
|
@ -1030,7 +1030,7 @@ bool Nibbler::getName (std::string& result)
|
|||
// A word is a contiguous string of non-space, non-digit, non-punct characters.
|
||||
bool Nibbler::getWord (std::string& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length)
|
||||
{
|
||||
|
@ -1083,7 +1083,7 @@ bool Nibbler::skipAll (char c)
|
|||
{
|
||||
if (_cursor < _length)
|
||||
{
|
||||
std::string::size_type i = _input.find_first_not_of (c, _cursor);
|
||||
auto i = _input.find_first_not_of (c, _cursor);
|
||||
if (i == _cursor)
|
||||
return false;
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ bool Nibbler::skipAllOneOf (const std::string& chars)
|
|||
{
|
||||
if (_cursor < _length)
|
||||
{
|
||||
std::string::size_type i = _input.find_first_not_of (chars, _cursor);
|
||||
auto i = _input.find_first_not_of (chars, _cursor);
|
||||
if (i == _cursor)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ std::string Path::name () const
|
|||
{
|
||||
if (_data.length ())
|
||||
{
|
||||
std::string::size_type slash = _data.rfind ('/');
|
||||
auto slash = _data.rfind ('/');
|
||||
if (slash != std::string::npos)
|
||||
return _data.substr (slash + 1, std::string::npos);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ std::string Path::parent () const
|
|||
{
|
||||
if (_data.length ())
|
||||
{
|
||||
std::string::size_type slash = _data.rfind ('/');
|
||||
auto slash = _data.rfind ('/');
|
||||
if (slash != std::string::npos)
|
||||
return _data.substr (0, slash);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ std::string Path::extension () const
|
|||
{
|
||||
if (_data.length ())
|
||||
{
|
||||
std::string::size_type dot = _data.rfind ('.');
|
||||
auto dot = _data.rfind ('.');
|
||||
if (dot != std::string::npos)
|
||||
return _data.substr (dot + 1, std::string::npos);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ std::string Path::expand (const std::string& in)
|
|||
{
|
||||
std::string copy = in;
|
||||
|
||||
std::string::size_type tilde = copy.find ("~");
|
||||
auto tilde = copy.find ("~");
|
||||
std::string::size_type slash;
|
||||
|
||||
if (tilde != std::string::npos)
|
||||
|
|
|
@ -464,7 +464,7 @@ const std::string TF2::dump ()
|
|||
|
||||
// File label.
|
||||
std::string label;
|
||||
std::string::size_type slash = _file._data.rfind ('/');
|
||||
auto slash = _file._data.rfind ('/');
|
||||
if (slash != std::string::npos)
|
||||
label = rightJustify (_file._data.substr (slash + 1), 14);
|
||||
|
||||
|
@ -791,7 +791,7 @@ void TDB2::revert_undo (
|
|||
}
|
||||
|
||||
// Extract identifying uuid.
|
||||
std::string::size_type uuidAtt = current.find ("uuid:\"");
|
||||
auto uuidAtt = current.find ("uuid:\"");
|
||||
if (uuidAtt != std::string::npos)
|
||||
uuid = current.substr (uuidAtt + 6, 36); // "uuid:"<uuid>" --> <uuid>
|
||||
else
|
||||
|
|
14
src/Task.cpp
14
src/Task.cpp
|
@ -1393,7 +1393,7 @@ void Task::validate (bool applyDefault /* = true */)
|
|||
if (var.first.substr (0, 4) == "uda." &&
|
||||
var.first.find (".default") != std::string::npos)
|
||||
{
|
||||
std::string::size_type period = var.first.find ('.', 4);
|
||||
auto period = var.first.find ('.', 4);
|
||||
if (period != std::string::npos)
|
||||
udas.push_back (var.first.substr (4, period - 4));
|
||||
}
|
||||
|
@ -1543,9 +1543,9 @@ int Task::determineVersion (const std::string& line)
|
|||
// uuid status [tags] [attributes] [annotations] description\n
|
||||
//
|
||||
// Scan for the number of [] pairs.
|
||||
std::string::size_type tagAtts = line.find ("] [", 0);
|
||||
std::string::size_type attsAnno = line.find ("] [", tagAtts + 1);
|
||||
std::string::size_type annoDesc = line.find ("] ", attsAnno + 1);
|
||||
auto tagAtts = line.find ("] [", 0);
|
||||
auto attsAnno = line.find ("] [", tagAtts + 1);
|
||||
auto annoDesc = line.find ("] ", attsAnno + 1);
|
||||
if (tagAtts != std::string::npos &&
|
||||
attsAnno != std::string::npos &&
|
||||
annoDesc != std::string::npos)
|
||||
|
@ -1630,7 +1630,7 @@ float Task::urgency_c () const
|
|||
if (var.first.substr (0, 13) == "urgency.user.")
|
||||
{
|
||||
// urgency.user.project.<project>.coefficient
|
||||
std::string::size_type end = std::string::npos;
|
||||
auto end = std::string::npos;
|
||||
if (var.first.substr (13, 8) == "project." &&
|
||||
(end = var.first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
|
@ -1664,11 +1664,11 @@ float Task::urgency_c () const
|
|||
{
|
||||
// urgency.uda.<name>.coefficient
|
||||
// urgency.uda.<name>.<value>.coefficient
|
||||
std::string::size_type end = var.first.find (".coefficient");
|
||||
auto end = var.first.find (".coefficient");
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
const std::string uda = var.first.substr (12, end - 12);
|
||||
std::string::size_type dot = uda.find (".");
|
||||
auto dot = uda.find (".");
|
||||
if (dot == std::string::npos)
|
||||
{
|
||||
// urgency.uda.<name>.coefficient
|
||||
|
|
|
@ -71,7 +71,7 @@ void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
|||
|
||||
if (_style == "parent")
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
auto period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ void ColumnProject::render (
|
|||
std::string project = task.get (_name);
|
||||
if (_style == "parent")
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
auto period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ extern Context context;
|
|||
Column* Column::factory (const std::string& name, const std::string& report)
|
||||
{
|
||||
// Decompose name into type and style.
|
||||
std::string::size_type dot = name.find ('.');
|
||||
auto dot = name.find ('.');
|
||||
std::string column_name;
|
||||
std::string column_style;
|
||||
if (dot != std::string::npos)
|
||||
|
|
|
@ -593,7 +593,7 @@ void Chart::optimizeGrid ()
|
|||
std::string::size_type ws;
|
||||
while ((ws = _grid.find (" \n")) != std::string::npos)
|
||||
{
|
||||
std::string::size_type non_ws = ws;
|
||||
auto non_ws = ws;
|
||||
while (_grid[non_ws] == ' ')
|
||||
--non_ws;
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ int CmdCalendar::execute (std::string& output)
|
|||
|
||||
// If the executable was "cal" or equivalent, replace it with "task".
|
||||
std::string executable = context.cli._args[0].attribute ("raw");
|
||||
std::string::size_type cal = executable.find ("cal");
|
||||
auto cal = executable.find ("cal");
|
||||
if (cal != std::string::npos)
|
||||
executable = executable.substr (0, cal) + PACKAGE;
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ bool CmdConfig::setConfigVariable (std::string name, std::string value, bool con
|
|||
for (auto& line : contents)
|
||||
{
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line.find ("#");
|
||||
std::string::size_type pos = line.find (name + "=");
|
||||
auto comment = line.find ("#");
|
||||
auto pos = line.find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
|
@ -110,8 +110,8 @@ int CmdConfig::unsetConfigVariable (std::string name, bool confirmation /* = fal
|
|||
bool lineDeleted = false;
|
||||
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line->find ("#");
|
||||
std::string::size_type pos = line->find (name + "=");
|
||||
auto comment = line->find ("#");
|
||||
auto pos = line->find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
|
|
|
@ -108,7 +108,7 @@ int CmdDenotate::execute (std::string& output)
|
|||
{
|
||||
for (auto i = annotations.begin (); i != annotations.end (); ++i)
|
||||
{
|
||||
std::string::size_type loc = find (i->second, pattern, sensitive);
|
||||
auto loc = find (i->second, pattern, sensitive);
|
||||
if (loc != std::string::npos)
|
||||
{
|
||||
anno = i->second;
|
||||
|
|
|
@ -285,7 +285,7 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
|
||||
// Get credentials, but mask out the key.
|
||||
std::string credentials = context.config.get ("taskd.credentials");
|
||||
std::string::size_type last_slash = credentials.rfind ('/');
|
||||
auto last_slash = credentials.rfind ('/');
|
||||
if (last_slash != std::string::npos)
|
||||
credentials = credentials.substr (0, last_slash)
|
||||
+ "/"
|
||||
|
|
|
@ -78,10 +78,10 @@ std::string CmdEdit::findValue (
|
|||
const std::string& text,
|
||||
const std::string& name)
|
||||
{
|
||||
std::string::size_type found = text.find (name);
|
||||
auto found = text.find (name);
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
std::string::size_type eol = text.find ("\n", found + 1);
|
||||
auto eol = text.find ("\n", found + 1);
|
||||
if (eol != std::string::npos)
|
||||
{
|
||||
std::string value = text.substr (
|
||||
|
@ -101,10 +101,10 @@ std::string CmdEdit::findMultilineValue (
|
|||
const std::string& startMarker,
|
||||
const std::string& endMarker)
|
||||
{
|
||||
std::string::size_type start = text.find (startMarker);
|
||||
auto start = text.find (startMarker);
|
||||
if (start != std::string::npos)
|
||||
{
|
||||
std::string::size_type end = text.find (endMarker, start);
|
||||
auto end = text.find (endMarker, start);
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
std::string value = text.substr (start + startMarker.length (),
|
||||
|
@ -128,7 +128,7 @@ std::vector <std::string> CmdEdit::findValues (
|
|||
found = text.find (name, found + 1);
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
std::string::size_type eol = text.find ("\n", found + 1);
|
||||
auto eol = text.find ("\n", found + 1);
|
||||
if (eol != std::string::npos)
|
||||
{
|
||||
std::string value = text.substr (
|
||||
|
@ -612,14 +612,14 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
{
|
||||
found += 14; // Length of "\n Annotation:".
|
||||
|
||||
std::string::size_type eol = after.find ("\n", found + 1);
|
||||
auto eol = after.find ("\n", found + 1);
|
||||
if (eol != std::string::npos)
|
||||
{
|
||||
std::string value = trim (after.substr (
|
||||
found,
|
||||
eol - found), "\t ");
|
||||
|
||||
std::string::size_type gap = value.find (" -- ");
|
||||
auto gap = value.find (" -- ");
|
||||
if (gap != std::string::npos)
|
||||
{
|
||||
// TODO keeping the initial dates even if dateformat approximates them
|
||||
|
@ -714,7 +714,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
|
|||
std::vector <std::string> orphanValues = findValues (after, "\n UDA Orphan ");
|
||||
for (auto& orphan : orphanValues)
|
||||
{
|
||||
std::string::size_type colon = orphan.find (':');
|
||||
auto colon = orphan.find (':');
|
||||
if (colon != std::string::npos)
|
||||
{
|
||||
std::string name = trim (orphan.substr (0, colon), "\t ");
|
||||
|
|
|
@ -426,7 +426,7 @@ int CmdInfo::execute (std::string& output)
|
|||
if (var.first.substr (0, 13) == "urgency.user.")
|
||||
{
|
||||
// urgency.user.project.<project>.coefficient
|
||||
std::string::size_type end = std::string::npos;
|
||||
auto end = std::string::npos;
|
||||
if (var.first.substr (13, 8) == "project." &&
|
||||
(end = var.first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
|
@ -459,11 +459,11 @@ int CmdInfo::execute (std::string& output)
|
|||
{
|
||||
// urgency.uda.<name>.coefficient
|
||||
// urgency.uda.<name>.<value>.coefficient
|
||||
std::string::size_type end = var.first.find (".coefficient");
|
||||
auto end = var.first.find (".coefficient");
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
const std::string uda = var.first.substr (12, end - 12);
|
||||
std::string::size_type dot = uda.find (".");
|
||||
auto dot = uda.find (".");
|
||||
if (dot == std::string::npos)
|
||||
{
|
||||
// urgency.uda.<name>.coefficient
|
||||
|
|
|
@ -56,7 +56,7 @@ int CmdReports::execute (std::string& output)
|
|||
if (i.first.substr (0, 7) == "report.")
|
||||
{
|
||||
std::string report = i.first.substr (7);
|
||||
std::string::size_type columns = report.find (".columns");
|
||||
auto columns = report.find (".columns");
|
||||
if (columns != std::string::npos)
|
||||
reports.push_back (report.substr (0, columns));
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ bool CmdSync::send (
|
|||
{
|
||||
// It is important that the ':' be the *last* colon, in order to support
|
||||
// IPv6 addresses.
|
||||
std::string::size_type colon = to.rfind (':');
|
||||
auto colon = to.rfind (':');
|
||||
if (colon == std::string::npos)
|
||||
throw format (STRING_CMD_SYNC_BAD_SERVER, to);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ int CmdUDAs::execute (std::string& output)
|
|||
if (name.first.substr (0, 4) == "uda." &&
|
||||
name.first.find (".type") != std::string::npos)
|
||||
{
|
||||
std::string::size_type period = name.first.find ('.', 4);
|
||||
auto period = name.first.find ('.', 4);
|
||||
if (period != std::string::npos)
|
||||
udas.push_back (name.first.substr (4, period - 4));
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ int CmdCompletionUDAs::execute (std::string& output)
|
|||
if (name.first.substr (0, 4) == "uda." &&
|
||||
name.first.find (".type") != std::string::npos)
|
||||
{
|
||||
std::string::size_type period = name.first.find ('.', 4);
|
||||
auto period = name.first.find ('.', 4);
|
||||
if (period != std::string::npos)
|
||||
udas.push_back (name.first.substr (4, period - 4));
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
if (i.first.substr (0, 7) == "report.")
|
||||
{
|
||||
std::string report = i.first.substr (7);
|
||||
std::string::size_type columns = report.find (".columns");
|
||||
auto columns = report.find (".columns");
|
||||
if (columns != std::string::npos)
|
||||
reports.push_back (report.substr (0, columns));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue