@ -1044,7 +1044,7 @@ Status OptionTypeInfo::Parse(const ConfigOptions& config_options,
}
}
try {
try {
if ( opt_addr = = nullptr ) {
if ( opt_addr = = nullptr ) {
return Status : : NotFound ( " Could not find option: " , opt_name ) ;
return Status : : NotFound ( " Could not find option " , opt_name ) ;
} else if ( parse_func_ ! = nullptr ) {
} else if ( parse_func_ ! = nullptr ) {
return parse_func_ ( config_options , opt_name , opt_value , opt_addr ) ;
return parse_func_ ( config_options , opt_name , opt_value , opt_addr ) ;
} else if ( ParseOptionHelper ( opt_addr , type_ , opt_value ) ) {
} else if ( ParseOptionHelper ( opt_addr , type_ , opt_value ) ) {
@ -1081,7 +1081,7 @@ Status OptionTypeInfo::ParseStruct(
iter - > second . Parse ( config_options , map_iter . first , map_iter . second ,
iter - > second . Parse ( config_options , map_iter . first , map_iter . second ,
opt_addr + iter - > second . offset_ ) ;
opt_addr + iter - > second . offset_ ) ;
} else {
} else {
status = Status : : InvalidArgument ( " Unrecognized option: " ,
status = Status : : InvalidArgument ( " Unrecognized option " ,
struct_name + " . " + map_iter . first ) ;
struct_name + " . " + map_iter . first ) ;
}
}
}
}
@ -1094,7 +1094,7 @@ Status OptionTypeInfo::ParseStruct(
status = opt_info - > Parse ( config_options , elem_name , opt_value ,
status = opt_info - > Parse ( config_options , elem_name , opt_value ,
opt_addr + opt_info - > offset_ ) ;
opt_addr + opt_info - > offset_ ) ;
} else {
} else {
status = Status : : InvalidArgument ( " Unrecognized option: " , opt_name ) ;
status = Status : : InvalidArgument ( " Unrecognized option " , opt_name ) ;
}
}
} else {
} else {
// This option represents a field in the struct (e.g. field)
// This option represents a field in the struct (e.g. field)
@ -1104,7 +1104,7 @@ Status OptionTypeInfo::ParseStruct(
status = opt_info - > Parse ( config_options , elem_name , opt_value ,
status = opt_info - > Parse ( config_options , elem_name , opt_value ,
opt_addr + opt_info - > offset_ ) ;
opt_addr + opt_info - > offset_ ) ;
} else {
} else {
status = Status : : InvalidArgument ( " Unrecognized option: " ,
status = Status : : InvalidArgument ( " Unrecognized option " ,
struct_name + " . " + opt_name ) ;
struct_name + " . " + opt_name ) ;
}
}
}
}
@ -1121,7 +1121,7 @@ Status OptionTypeInfo::Serialize(const ConfigOptions& config_options,
if ( serialize_func_ ! = nullptr ) {
if ( serialize_func_ ! = nullptr ) {
return serialize_func_ ( config_options , opt_name , opt_addr , opt_value ) ;
return serialize_func_ ( config_options , opt_name , opt_addr , opt_value ) ;
} else if ( ! SerializeSingleOptionHelper ( opt_addr , type_ , opt_value ) ) {
} else if ( ! SerializeSingleOptionHelper ( opt_addr , type_ , opt_value ) ) {
return Status : : InvalidArgument ( " Cannot serialize option: " , opt_name ) ;
return Status : : InvalidArgument ( " Cannot serialize option " , opt_name ) ;
}
}
}
}
return Status : : OK ( ) ;
return Status : : OK ( ) ;
@ -1164,14 +1164,14 @@ Status OptionTypeInfo::SerializeStruct(
status = opt_info - > Serialize ( config_options , elem_name ,
status = opt_info - > Serialize ( config_options , elem_name ,
opt_addr + opt_info - > offset_ , value ) ;
opt_addr + opt_info - > offset_ , value ) ;
} else {
} else {
status = Status : : InvalidArgument ( " Unrecognized option: " , opt_name ) ;
status = Status : : InvalidArgument ( " Unrecognized option " , opt_name ) ;
}
}
} else {
} else {
// This option represents a field in the struct (e.g. field)
// This option represents a field in the struct (e.g. field)
std : : string elem_name ;
std : : string elem_name ;
const auto opt_info = Find ( opt_name , * struct_map , & elem_name ) ;
const auto opt_info = Find ( opt_name , * struct_map , & elem_name ) ;
if ( opt_info = = nullptr ) {
if ( opt_info = = nullptr ) {
status = Status : : InvalidArgument ( " Unrecognized option: " , opt_name ) ;
status = Status : : InvalidArgument ( " Unrecognized option " , opt_name ) ;
} else if ( opt_info - > ShouldSerialize ( ) ) {
} else if ( opt_info - > ShouldSerialize ( ) ) {
status = opt_info - > Serialize ( config_options , opt_name + " . " + elem_name ,
status = opt_info - > Serialize ( config_options , opt_name + " . " + elem_name ,
opt_addr + opt_info - > offset_ , value ) ;
opt_addr + opt_info - > offset_ , value ) ;