Cleanup: Don't use string literals when character literals are needed

This commit is contained in:
Paul Beckingham 2016-10-14 23:11:28 -04:00
parent 95f4989f77
commit 8922728888
27 changed files with 122 additions and 122 deletions

View file

@ -125,7 +125,7 @@ void ColumnDepends::render (
dependencyGetBlocking (task, blocking);
if (_style == "count")
renderStringRight (lines, width, color, "[" + format (static_cast <int>(blocking.size ())) + "]");
renderStringRight (lines, width, color, '[' + format (static_cast <int>(blocking.size ())) + ']');
else if (_style == "default" ||
_style == "list")

View file

@ -238,7 +238,7 @@ void ColumnDescription::render (
else if (_style == "count")
{
if (task.annotation_count)
description += " [" + format (task.annotation_count) + "]";
description += " [" + format (task.annotation_count) + ']';
std::vector <std::string> raw;
wrapText (raw, description, width, _hyphenate);
@ -256,7 +256,7 @@ void ColumnDescription::render (
int len_annos = 0;
if (task.annotation_count)
{
annos_count = " [" + format (task.annotation_count) + "]";
annos_count = " [" + format (task.annotation_count) + ']';
len_annos = utf8_width (annos_count);
len += len_annos;
}

View file

@ -134,7 +134,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
Variant v;
e.evaluateInfixExpression (value, v);
task.set (_name, (std::string) v);
context.debug (label + _name + " <-- '" + (std::string) v + "' <-- '" + value + "'");
context.debug (label + _name + " <-- '" + (std::string) v + "' <-- '" + value + '\'');
}
catch (const std::string& e)
{
@ -143,7 +143,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
if (e == STRING_EVAL_NOT_EXPRESSION)
{
task.set (_name, value);
context.debug (label + _name + " <-- '" + value + "'");
context.debug (label + _name + " <-- '" + value + '\'');
}
else
throw;
@ -152,7 +152,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
else
{
task.set (_name, value);
context.debug (label + _name + " <-- '" + value + "'");
context.debug (label + _name + " <-- '" + value + '\'');
}
}

View file

@ -129,7 +129,7 @@ void ColumnRecur::modify (Task& task, const std::string& value)
{
// Store the raw value, for 'recur'.
std::string label = " MODIFICATION ";
context.debug (label + _name + " <-- '" + value + "'");
context.debug (label + _name + " <-- '" + value + '\'');
task.set (_name, value);
}
else

View file

@ -154,7 +154,7 @@ void ColumnTags::render (
{
std::vector <std::string> all;
split (all, tags, ',');
renderStringRight (lines, width, color, "[" + format (static_cast <int> (all.size ())) + "]");
renderStringRight (lines, width, color, '[' + format (static_cast <int> (all.size ())) + ']');
}
}
}
@ -187,12 +187,12 @@ void ColumnTags::modify (Task& task, const std::string& value)
Variant v;
e.evaluateInfixExpression (value, v);
task.addTag ((std::string) v);
context.debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + "'");
context.debug (label + "tags <-- '" + (std::string) v + "' <-- '" + tag + '\'');
}
else
{
task.addTag (tag);
context.debug (label + "tags <-- '" + tag + "'");
context.debug (label + "tags <-- '" + tag + '\'');
}
feedback_special_tags (task, tag);

View file

@ -61,7 +61,7 @@ ColumnTypeDate::ColumnTypeDate ()
now.toEpochString (),
now.toISO (),
ISO8601p (ISO8601d () - now).formatVague (),
"-" + ISO8601p (ISO8601d () - now).formatVague (),
'-' + ISO8601p (ISO8601d () - now).formatVague (),
"",
ISO8601p (ISO8601d () - now).format ()};
}
@ -183,7 +183,7 @@ void ColumnTypeDate::render (
if (now > date)
renderStringLeft (lines, width, color, ISO8601p (now - date).formatVague ());
else
renderStringLeft (lines, width, color, "-" + ISO8601p (date - now).formatVague ());
renderStringLeft (lines, width, color, '-' + ISO8601p (date - now).formatVague ());
}
else if (_style == "relative")
{
@ -191,7 +191,7 @@ void ColumnTypeDate::render (
if (now < date)
renderStringLeft (lines, width, color, ISO8601p (date - now).formatVague ());
else
renderStringLeft (lines, width, color, "-" + ISO8601p (now - date).formatVague ());
renderStringLeft (lines, width, color, '-' + ISO8601p (now - date).formatVague ());
}
else if (_style == "remaining")
@ -226,7 +226,7 @@ void ColumnTypeDate::modify (Task& task, const std::string& value)
std::string label = " MODIFICATION ";
if (evaluatedValue.type () == Variant::type_duration)
{
context.debug (label + _name + " <-- '" + format ("{1}", format (evaluatedValue.get_duration ())) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + "'");
context.debug (label + _name + " <-- '" + format ("{1}", format (evaluatedValue.get_duration ())) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
Variant now;
if (namedDates ("now", now))
evaluatedValue += now;
@ -234,7 +234,7 @@ void ColumnTypeDate::modify (Task& task, const std::string& value)
else
{
evaluatedValue.cast (Variant::type_date);
context.debug (label + _name + " <-- '" + format ("{1}", evaluatedValue.get_date ()) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + "'");
context.debug (label + _name + " <-- '" + format ("{1}", evaluatedValue.get_date ()) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\'');
}
// If a date doesn't parse (2/29/2014) then it evaluates to zero.

View file

@ -68,7 +68,7 @@ void ColumnTypeDuration::modify (Task& task, const std::string& value)
if (evaluatedValue.type () == Variant::type_duration)
{
// Store the raw value, for 'recur'.
context.debug (label + _name + " <-- " + (std::string) evaluatedValue + " <-- '" + value + "'");
context.debug (label + _name + " <-- " + (std::string) evaluatedValue + " <-- '" + value + '\'');
task.set (_name, evaluatedValue);
}
else

View file

@ -63,7 +63,7 @@ void ColumnTypeNumeric::modify (Task& task, const std::string& value)
}
std::string label = " MODIFICATION ";
context.debug (label + _name + " <-- '" + evaluatedValue.get_string () + "' <-- '" + value + "'");
context.debug (label + _name + " <-- '" + evaluatedValue.get_string () + "' <-- '" + value + '\'');
// If the result is not readily convertible to a numeric value, then this is
// an error.

View file

@ -66,7 +66,7 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
if (validate (strValue))
{
task.set (_name, strValue);
context.debug (label + _name + " <-- '" + strValue + "' <-- '" + value + "'");
context.debug (label + _name + " <-- '" + strValue + "' <-- '" + value + '\'');
}
else
throw format (STRING_INVALID_MOD, _name, value);
@ -76,7 +76,7 @@ void ColumnTypeString::modify (Task& task, const std::string& value)
if (validate (value))
{
task.set (_name, value);
context.debug (label + _name + " <-- '" + value + "'");
context.debug (label + _name + " <-- '" + value + '\'');
}
else
throw format (STRING_INVALID_MOD, _name, value);