C++: Implement InputFormat::get_options()

This commit is contained in:
Martin Ling 2014-08-24 14:22:03 +01:00 committed by Bert Vermeulen
parent 6e5240f418
commit 43942280bb
2 changed files with 14 additions and 0 deletions

View File

@ -1128,6 +1128,19 @@ string InputFormat::get_description()
return valid_string(sr_input_description_get(structure)); return valid_string(sr_input_description_get(structure));
} }
map<string, shared_ptr<Option>> InputFormat::get_options()
{
const struct sr_option *option = sr_input_options_get(structure);
auto option_array = shared_ptr<const struct sr_option>(
option, [=](const struct sr_option *) {
sr_input_options_free(structure); });
map<string, shared_ptr<Option>> result;
for (; option->id; option++)
result[option->id] = shared_ptr<Option>(
new Option(option, option_array), Option::Deleter());
return result;
}
shared_ptr<Input> InputFormat::create_input( shared_ptr<Input> InputFormat::create_input(
map<string, Glib::VariantBase> options) map<string, Glib::VariantBase> options)
{ {

View File

@ -825,6 +825,7 @@ protected:
void operator()(Option *option) { delete option; } void operator()(Option *option) { delete option; }
}; };
friend class Deleter; friend class Deleter;
friend class InputFormat;
friend class OutputFormat; friend class OutputFormat;
}; };