Add a register_option overload to GncOptionDB

For compatibility with existing scheme code.
This commit is contained in:
John Ralls
2021-01-04 17:08:03 -08:00
parent cb7270cafe
commit 7fa6778b4b
3 changed files with 13 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ public:
size_t num_sections() const noexcept { return m_sections.size(); }
bool get_changed() const noexcept { return m_dirty; }
void register_option(const char* section, GncOption&& option);
void register_option(const char* section, GncOption* option);
void unregister_option(const char* section, const char* name);
void set_default_section(const char* section);
const GncOptionSection* const get_default_section() const noexcept;

View File

@@ -168,6 +168,13 @@ GncOptionDB::register_option(const char* sectname, GncOption&& option)
m_sections.back()->add_option(std::move(option));
}
void
GncOptionDB::register_option(const char* sectname, GncOption* option)
{
register_option(sectname, std::move(*option));
delete option;
}
void
GncOptionDB::unregister_option(const char* sectname, const char* name)
{

View File

@@ -364,6 +364,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB);
%ignore gnc_option_to_scheme;
%ignore gnc_option_from_scheme;
/* GncOptionDB::register_option comes in GncOption* and GncOption&&
* overloads. The latter isn't useful to SWIG, ignore it.
*/
%ignore GncOptionDB::register_option(const char*, GncOption&&);
/* The following functions are overloaded in gnc-optiondb.hpp to provide both
* GncOptionDB* and GncOptionDBPtr& versions. That confuses SWIG so ignore the
* raw-ptr version.