49#include <cppthread/log.h>
54#include <snapdev/int128_literal.h>
55#include <snapdev/math.h>
60#include <snapdev/poison.h>
81 validator::register_validator(*
this);
86 return std::string(
"size");
91 return std::make_shared<validator_size>(data);
137 else if(
r ==
"legacy")
143 cppthread::log << cppthread::log_level_t::error
145 <<
" is not a valid flag for the size validator."
161 return std::string(
"size");
177#pragma GCC diagnostic push
178#pragma GCC diagnostic ignored "-Wpedantic"
181 using namespace snapdev::literals;
185#pragma GCC diagnostic pop
242#pragma GCC diagnostic push
243#pragma GCC diagnostic ignored "-Wpedantic"
245 std::string
const & value
249 using namespace snapdev::literals;
254 std::string::size_type
pos(value.length());
257 char c(value[
pos - 1]);
273 std::string
const number(value.substr(0,
pos));
275 if(
pos < value.length())
282 for(;
pos < value.length(); ++
pos)
285 && value[
pos] <=
'Z')
471#pragma GCC diagnostic pop
virtual std::string get_name() const override
virtual std::shared_ptr< validator > create(string_list_t const &data) const override
static bool convert_string(std::string const &number, double &result)
Convert a string to a double value.
static constexpr flag_t VALIDATOR_SIZE_POWER_OF_TWO
static bool convert_string(std::string const &size, flag_t flags, __int128 &result)
Convert a string to a large integer (128 bits) value representing a size.
virtual std::string name() const override
Return the name of this validator.
validator_size(string_list_t const &data)
Initialize the size validator.
virtual bool validate(std::string const &value) const override
Determine whether value is a valid size.
validator_size_factory g_validator_size_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.