40#include <cppthread/log.h>
45#include <snapdev/poison.h>
65 validator::register_validator(*
this);
70 return std::string(
"duration");
75 return std::make_shared<validator_duration>(data);
120 else if(
r ==
"large")
126 cppthread::log << cppthread::log_level_t::error
128 <<
" is not a valid flag for the duration validator."
144 return std::string(
"duration");
205 std::string
const & value
213 char const *
s(value.c_str());
234 while(*
s >=
'0' && *
s <=
'9')
244 while(*
s >=
'0' && *
s <=
'9');
254#pragma GCC diagnostic push
255#pragma GCC diagnostic ignored "-Wrestrict"
262#pragma GCC diagnostic pop
335 else if(
suffix ==
"minute"
virtual std::shared_ptr< validator > create(string_list_t const &data) const override
validator_duration_factory()
virtual std::string get_name() const override
static bool convert_string(std::string const &number, double &result)
Convert a string to a double value.
static bool convert_string(std::string const &duration, flag_t flags, double &result)
Convert a string to a double value representing a duration.
virtual std::string name() const override
Return the name of this validator.
virtual bool validate(std::string const &value) const override
Determine whether value is a valid duration.
validator_duration(string_list_t const &data)
Initialize the duration validator.
static constexpr flag_t VALIDATOR_DURATION_LONG
validator_duration_factory g_validator_duration_factory
The advgetopt environment to parse command line options.
constexpr flag_t option_flags_merge()
std::vector< std::string > string_list_t
Declaration of validators which can be used to verify the parameters.
Declaration of validators which can be used to verify the parameters.