ColDescription: Migrated from ISO8601d to Datetime

This commit is contained in:
Paul Beckingham 2016-12-17 21:44:29 -05:00
parent 1908d50be8
commit a81e66b609

View file

@ -28,7 +28,7 @@
#include <ColDescription.h> #include <ColDescription.h>
#include <stdlib.h> #include <stdlib.h>
#include <Context.h> #include <Context.h>
#include <ISO8601.h> #include <Datetime.h>
#include <shared.h> #include <shared.h>
#include <format.h> #include <format.h>
#include <utf8.h> #include <utf8.h>
@ -55,7 +55,7 @@ ColumnDescription::ColumnDescription ()
if (_dateformat == "") if (_dateformat == "")
_dateformat = context.config.get ("dateformat"); _dateformat = context.config.get ("dateformat");
std::string t = ISO8601d ().toString (_dateformat); std::string t = Datetime ().toString (_dateformat);
std::string d = STRING_COLUMN_EXAMPLES_DESC; std::string d = STRING_COLUMN_EXAMPLES_DESC;
std::string a1 = STRING_COLUMN_EXAMPLES_ANNO1; std::string a1 = STRING_COLUMN_EXAMPLES_ANNO1;
std::string a2 = STRING_COLUMN_EXAMPLES_ANNO2; std::string a2 = STRING_COLUMN_EXAMPLES_ANNO2;
@ -97,7 +97,7 @@ void ColumnDescription::measure (Task& task, unsigned int& minimum, unsigned int
if (task.annotation_count) if (task.annotation_count)
{ {
unsigned int min_anno = _indent + ISO8601d::length (_dateformat); unsigned int min_anno = _indent + Datetime::length (_dateformat);
if (min_anno > minimum) if (min_anno > minimum)
minimum = min_anno; minimum = min_anno;
@ -127,7 +127,7 @@ void ColumnDescription::measure (Task& task, unsigned int& minimum, unsigned int
if (task.annotation_count) if (task.annotation_count)
{ {
auto min_anno = ISO8601d::length (_dateformat); auto min_anno = Datetime::length (_dateformat);
std::map <std::string, std::string> annos; std::map <std::string, std::string> annos;
task.getAnnotations (annos); task.getAnnotations (annos);
for (auto& i : annos) for (auto& i : annos)
@ -182,7 +182,7 @@ void ColumnDescription::render (
task.getAnnotations (annos); task.getAnnotations (annos);
for (const auto& i : annos) for (const auto& i : annos)
{ {
ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10)); Datetime dt (strtol (i.first.substr (11).c_str (), NULL, 10));
description += '\n' + std::string (_indent, ' ') + dt.toString (_dateformat) + ' ' + i.second; description += '\n' + std::string (_indent, ' ') + dt.toString (_dateformat) + ' ' + i.second;
} }
} }
@ -213,7 +213,7 @@ void ColumnDescription::render (
task.getAnnotations (annos); task.getAnnotations (annos);
for (const auto& i : annos) for (const auto& i : annos)
{ {
ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10)); Datetime dt (strtol (i.first.substr (11).c_str (), NULL, 10));
description += ' ' + dt.toString (_dateformat) + ' ' + i.second; description += ' ' + dt.toString (_dateformat) + ' ' + i.second;
} }
} }