void
set_annotate(write_context& ctxt, bool flag);
+
+/// A convenience generic function to set common options (usually used
+/// by Libabigail tools) from a generic options carrying-object, into
+/// a given @ref write_context.
+///
+/// @param ctxt the @ref the write_context to consider.
+///
+/// @param opts the option-carrying object to set the options from.
+/// It must contain data members named: annotate, and show_locs, at
+/// very least.
+template <typename OPTS>
+void
+set_common_options(write_context& ctxt, const OPTS& opts)
+{
+ set_annotate(ctxt, opts.annotate);
+ set_show_locs(ctxt, opts.show_locs);
+}
+
void
set_ostream(write_context& ctxt, ostream& os);
{
const write_context_sptr& write_ctxt
= create_write_context(corp->get_environment(), cout);
- set_annotate(*write_ctxt, opts.annotate);
- set_show_locs(*write_ctxt, opts.show_locs);
+ set_common_options(*write_ctxt, opts);
if (opts.abidiff)
{
{
const xml_writer::write_context_sptr& ctxt
= xml_writer::create_write_context(group->get_environment(), cout);
- set_annotate(*ctxt, opts.annotate);
+ set_common_options(*ctxt, opts);
if (!opts.out_file_path.empty())
{