const DataType *ConfigKey::data_type() const
{
- const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, _id);
+ const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, id());
if (!info)
throw Error(SR_ERR_NA);
return DataType::get(info->datatype);
string ConfigKey::identifier() const
{
- const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, _id);
+ const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, id());
if (!info)
throw Error(SR_ERR_NA);
return valid_string(info->id);
string ConfigKey::description() const
{
- const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, _id);
+ const struct sr_key_info *info = sr_key_info_get(SR_KEY_CONFIG, id());
if (!info)
throw Error(SR_ERR_NA);
return valid_string(info->name);
return get(info->key);
}
-#include "config.h"
+#include <config.h>
#ifndef HAVE_STOI_STOD
variant = g_variant_new_boolean(sr_parse_boolstring(value.c_str()));
break;
case SR_T_FLOAT:
- variant = g_variant_new_double(stod(value));
+ try {
+ variant = g_variant_new_double(stod(value));
+ } catch (invalid_argument) {
+ throw Error(SR_ERR_ARG);
+ }
break;
case SR_T_RATIONAL_PERIOD:
check(sr_parse_period(value.c_str(), &p, &q));
variant = g_variant_new("(tt)", p, q);
break;
case SR_T_INT32:
- variant = g_variant_new_int32(stoi(value));
+ try {
+ variant = g_variant_new_int32(stoi(value));
+ } catch (invalid_argument) {
+ throw Error(SR_ERR_ARG);
+ }
break;
default:
throw Error(SR_ERR_BUG);