Extract function CLI::getDuration ()

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2020-02-29 16:08:42 +01:00
parent 0c1d7291e2
commit e8511c5efd
5 changed files with 22 additions and 32 deletions

View file

@ -34,6 +34,7 @@
#include <sstream>
#include <algorithm>
#include <set>
#include <Duration.h>
////////////////////////////////////////////////////////////////////////////////
A2::A2 (const std::string& raw, Lexer::Type lextype)
@ -589,3 +590,19 @@ std::string CLI::getAnnotation () const
}
////////////////////////////////////////////////////////////////////////////////
Duration CLI::getDuration () const
{
std::string delta;
for (auto& arg : _args)
{
if (arg.hasTag ("FILTER") &&
arg._lextype == Lexer::Type::duration)
{
delta = arg.attribute ("raw");
}
}
Duration dur (delta);
return dur;
}
////////////////////////////////////////////////////////////////////////////////