Instantiate GncOption::set_option for guile, initial types string and int.

For proof-of-concept. Guile obviously doesn't know about templates.
This commit is contained in:
John Ralls 2019-10-12 18:16:05 -07:00
parent 9cdcaf0da8
commit cee3cdaff9
2 changed files with 10 additions and 2 deletions

View File

@ -51,5 +51,9 @@ extern "C" SCM scm_init_sw_gnc_optiondb_module(void);
%ignore GncOption; %ignore GncOption;
wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); wrap_unique_ptr(GncOptionDBPtr, GncOptionDB);
%include "gnc-optiondb.hpp" %include "gnc-optiondb.hpp"
%extend GncOptionDB {
%template(set_option_string) set_option<std::string>;
%template(set_option_int) set_option<int>;
};

View File

@ -40,6 +40,10 @@
(let* ((option-db (gnc-option-db-new)) (let* ((option-db (gnc-option-db-new))
(string-opt (gnc-register-string-option option-db "foo" "bar" "baz" (string-opt (gnc-register-string-option option-db "foo" "bar" "baz"
"Phony Option" "waldo"))) "Phony Option" "waldo")))
(test-equal (GncOptionDB-lookup-option (GncOptionDBPtr-get option-db) "foo" "bar") "waldo")) (test-equal "waldo" (GncOptionDB-lookup-option
(GncOptionDBPtr-get option-db) "foo" "bar"))
(GncOptionDB-set-option-string (GncOptionDBPtr-get option-db) "foo" "bar" "pepper")
(test-equal "pepper" (GncOptionDB-lookup-option
(GncOptionDBPtr-get option-db) "foo" "bar")))
(test-end "test-gnc-make-string-option")) (test-end "test-gnc-make-string-option"))