mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Columns: Removed redundant format checking
This commit is contained in:
parent
ebd6273c86
commit
09562c8fac
17 changed files with 0 additions and 57 deletions
|
@ -102,8 +102,6 @@ void ColumnDepends::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
||||||
minimum = length;
|
minimum = length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,9 +153,6 @@ void ColumnDescription::measure (Task& task, unsigned int& minimum, unsigned int
|
||||||
minimum = 4;
|
minimum = 4;
|
||||||
maximum = utf8_width (description) + 1 + 1 + format (task.annotation_count).length () + 1;
|
maximum = utf8_width (description) + 1 + 1 + format (task.annotation_count).length () + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -55,10 +55,6 @@ void ColumnID::measure (Task& task, unsigned int& minimum, unsigned int& maximum
|
||||||
else length = 1 + (int) log10 ((double) task.id); // Slow
|
else length = 1 + (int) log10 ((double) task.id); // Slow
|
||||||
|
|
||||||
minimum = maximum = length;
|
minimum = maximum = length;
|
||||||
|
|
||||||
if (_style != "default" &&
|
|
||||||
_style != "number")
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -46,13 +46,7 @@ void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
||||||
{
|
{
|
||||||
minimum = maximum = 0;
|
minimum = maximum = 0;
|
||||||
if (task.has (_name))
|
if (task.has (_name))
|
||||||
{
|
|
||||||
minimum = maximum = task.get (_name).length ();
|
minimum = maximum = task.get (_name).length ();
|
||||||
|
|
||||||
if (_style != "default" &&
|
|
||||||
_style != "number")
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -46,13 +46,7 @@ void ColumnLast::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
||||||
{
|
{
|
||||||
minimum = maximum = 0;
|
minimum = maximum = 0;
|
||||||
if (task.has (_name))
|
if (task.has (_name))
|
||||||
{
|
|
||||||
minimum = maximum = task.get (_name).length ();
|
minimum = maximum = task.get (_name).length ();
|
||||||
|
|
||||||
if (_style != "default" &&
|
|
||||||
_style != "number")
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -46,12 +46,7 @@ void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
||||||
{
|
{
|
||||||
minimum = maximum = 0;
|
minimum = maximum = 0;
|
||||||
if (task.has (_name))
|
if (task.has (_name))
|
||||||
{
|
|
||||||
minimum = maximum = task.get (_name).length ();
|
minimum = maximum = task.get (_name).length ();
|
||||||
|
|
||||||
if (_style != "default")
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -49,8 +49,6 @@ void ColumnParent::measure (Task& task, unsigned int& minimum, unsigned int& max
|
||||||
{
|
{
|
||||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||||
else if (_style == "short") minimum = maximum = 8;
|
else if (_style == "short") minimum = maximum = 8;
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,6 @@ void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
||||||
{
|
{
|
||||||
project = indentProject (project, " ", '.');
|
project = indentProject (project, " ", '.');
|
||||||
}
|
}
|
||||||
else if (_style != "default" &&
|
|
||||||
_style != "full" &&
|
|
||||||
_style != "indented")
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
|
|
||||||
minimum = longestWord (project);
|
minimum = longestWord (project);
|
||||||
maximum = utf8_width (project);
|
maximum = utf8_width (project);
|
||||||
|
|
|
@ -67,8 +67,6 @@ void ColumnRType::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
||||||
minimum = maximum = task.get (_name).length ();
|
minimum = maximum = task.get (_name).length ();
|
||||||
else if (_style == "indicator")
|
else if (_style == "indicator")
|
||||||
minimum = maximum = 1;
|
minimum = maximum = 1;
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,6 @@ void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maxi
|
||||||
{
|
{
|
||||||
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
|
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,6 @@ void ColumnStatus::measure (Task& task, unsigned int& minimum, unsigned int& max
|
||||||
}
|
}
|
||||||
else if (_style == "short")
|
else if (_style == "short")
|
||||||
minimum = maximum = 1;
|
minimum = maximum = 1;
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -108,8 +108,6 @@ void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maxim
|
||||||
else
|
else
|
||||||
minimum = maximum = utf8_width (tags);
|
minimum = maximum = utf8_width (tags);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@ void ColumnTemplate::measure (Task& task, unsigned int& minimum, unsigned int& m
|
||||||
{
|
{
|
||||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||||
else if (_style == "short") minimum = maximum = 8;
|
else if (_style == "short") minimum = maximum = 8;
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,6 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m
|
||||||
if (date > now)
|
if (date > now)
|
||||||
minimum = maximum = Duration (date - now).formatVague ().length ();
|
minimum = maximum = Duration (date - now).formatVague ().length ();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,6 @@ void ColumnUDAString::measure (Task& task, unsigned int& minimum, unsigned int&
|
||||||
|
|
||||||
minimum = maximum = utf8_width (indicator);
|
minimum = maximum = utf8_width (indicator);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +172,6 @@ void ColumnUDANumeric::measure (Task& task, unsigned int& minimum, unsigned int&
|
||||||
|
|
||||||
minimum = maximum = utf8_width (indicator);
|
minimum = maximum = utf8_width (indicator);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,8 +262,6 @@ void ColumnUDADate::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
||||||
|
|
||||||
minimum = maximum = utf8_width (indicator);
|
minimum = maximum = utf8_width (indicator);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,8 +357,6 @@ void ColumnUDADuration::measure (Task& task, unsigned int& minimum, unsigned int
|
||||||
else
|
else
|
||||||
minimum = maximum = 0;
|
minimum = maximum = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,6 @@ void ColumnUUID::measure (Task&, unsigned int& minimum, unsigned int& maximum)
|
||||||
|
|
||||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||||
else if (_style == "short") minimum = maximum = 8;
|
else if (_style == "short") minimum = maximum = 8;
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -49,9 +49,6 @@ void ColumnUrgency::measure (Task& task, unsigned int& minimum, unsigned int& ma
|
||||||
|
|
||||||
else if (_style == "integer")
|
else if (_style == "integer")
|
||||||
minimum = maximum = format ((int)task.urgency ()).length ();
|
minimum = maximum = format ((int)task.urgency ()).length ();
|
||||||
|
|
||||||
else
|
|
||||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue