7 #ifndef SIMPLE_PARSER_H 8 #define SIMPLE_PARSER_H 128 const std::string& name);
140 const std::string& name);
152 const std::string& name);
180 template <
typename int_type> int_type
182 const std::string& name) {
184 if ((val_int < std::numeric_limits<int_type>::min()) ||
185 (val_int > std::numeric_limits<int_type>::max())) {
187 "out of range value (" << val_int
188 <<
") specified for parameter '" << name
191 return (static_cast<int_type>(val_int));
206 template <
typename target_type,
207 target_type convert(
const std::string&)> target_type
209 const std::string& name,
210 const std::string& type_name) {
211 std::string str =
getString(scope, name);
213 return (convert(str));
214 }
catch (
const std::exception&) {
216 "invalid " << type_name <<
" (" << str
217 <<
") specified for parameter '" << name
232 const std::string& name) {
233 return (getIntType<uint32_t>(scope, name));
245 const std::string& name) {
246 return (getIntType<uint16_t>(scope, name));
258 return (getIntType<uint8_t>(scope, name));
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet)
boost::shared_ptr< Element > ElementPtr
const isc::data::Element::types type_
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
static size_t deriveParams(isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList ¶ms)
Derives (inherits) parameters from parent scope to a child.
To be removed. Please use ConfigError instead.
SimpleDefault(const char *name, isc::data::Element::types type, const char *value)
uint8_t getUint8(ConstElementPtr scope, const std::string &name)
Get an uint8_t value.
static size_t setDefaults(isc::data::ElementPtr scope, const SimpleDefaults &default_values)
Sets the default values.
boost::shared_ptr< const Element > ConstElementPtr
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
This array defines a single entry of default values.
static size_t setListDefaults(isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
Sets the default values for all entries in a list.
uint32_t getUint32(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint32_t.
Represents the position of the data element within a configuration string.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static isc::asiolink::IOAddress getAddress(const ConstElementPtr &scope, const std::string &name)
Returns a IOAddress parameter from a scope.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::vector< std::string > ParamsList
This defines a list of all parameters that are derived (or inherited) between contexts.
target_type getAndConvert(isc::data::ConstElementPtr scope, const std::string &name, const std::string &type_name)
Returns a converted value from a scope.
int_type getIntType(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer value with range checking from a scope.
The IOAddress class represents an IP addresses (version agnostic)
uint16_t getUint16(isc::data::ConstElementPtr scope, const std::string &name)
Returns a value converted to uint16_t.