From: Francis Dupont Date: Thu, 26 Jan 2017 21:20:28 +0000 (+0100) Subject: [5123] Removed old templates X-Git-Tag: trac5126_base~2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c6829533d215a116a7039c467bb41e3dc1079e0;p=thirdparty%2Fkea.git [5123] Removed old templates --- diff --git a/src/lib/cc/simple_parser.h b/src/lib/cc/simple_parser.h index 6f758f98a8..3da63a6ce0 100644 --- a/src/lib/cc/simple_parser.h +++ b/src/lib/cc/simple_parser.h @@ -199,60 +199,6 @@ protected: << "' (" << getPosition(name, scope) << ")"); } } - - /// @todo remove this when they'll be no longer used. - - /// @brief Returns an integer value with range checking - /// - /// This template should be instantied in parsers when useful - /// - /// @tparam int_type the integer type e.g. uint32_t - /// @tparam out_of_range always @c isc::dhcp::DhcpConfigError - /// @param name name of the parameter for error report - /// @param value value of the parameter - /// @return a value of int_type - /// @throw isc::data::TypeError when the value is not an integer - /// @throw out_of_range when the value does not fit in int_type - template int_type - extractInt(const std::string& name, ConstElementPtr value) const { - int64_t val_int = value->intValue(); - if ((val_int < std::numeric_limits::min()) || - (val_int > std::numeric_limits::max())) { - isc_throw(out_of_range, "out of range value (" << val_int - << ") specified for parameter '" << name - << "' (" << value->getPosition() << ")"); - } - return (static_cast(val_int)); - } - - /// @brief Returns a converted value - /// - /// This template should be instantied in parsers when useful - /// - /// @tparam target_type the type of the result - /// @tparam convert the conversion function std::string -> target_type - /// @tparam exception_type always @c isc::dhcp::DhcpConfigError - /// @param name name of the parameter for error report - /// @param type_name name of target_type for error report - /// @param value value of the parameter - /// @return a converted value of target_type - /// @throw isc::data::TypeError when the value is not an integer - /// @throw exception_type when the value cannot be converted - template target_type - extractConvert(const std::string& name, - const std::string& type_name, - ConstElementPtr value) const { - std::string str = value->stringValue(); - try { - return (convert(str)); - } catch (const std::exception&) { - isc_throw(exception_type, "invalid " << type_name << " (" << str - << ") specified for parameter '" << name - << "' (" << value->getPosition() << ")"); - } - } }; };