Commit Graph

20 Commits

Author SHA1 Message Date
John Ralls
76172af239 Implement saving and loading OptionDB items to/from scheme and
key-value string representations.
2021-07-10 17:24:57 -07:00
John Ralls
6ab5618b76 Set a 50-character limit on the saved size of option section and name.
Allows use of istream::getline() to retrieve the values, simplifying
delimiter detection.
2021-07-10 17:24:57 -07:00
John Ralls
52d0ec5290 Change GncOptionDateValue design to better match usage.
Added advantage that it handles (not correctly, but in the same way as
the old code) the ambiguity between a period starting or ending with
the stored value "relative . today".
2021-07-10 17:24:57 -07:00
John Ralls
883127a59d Implement operators >> and << on GncOption. 2021-07-10 17:24:57 -07:00
John Ralls
b95ea2c4aa Add Account-list options. 2021-07-10 17:24:57 -07:00
John Ralls
3f576671aa Adapt GncOptionMultiChoiceValue to support list options.
Main change adds a value field to the constructor to set the value and
default value.
2021-07-10 17:24:57 -07:00
John Ralls
3dc4bc2377 Implement GncOptionDateValue. 2021-07-10 17:24:57 -07:00
John Ralls
435667e8fe Implement GncOptionMultichoiceValue
Replaces GncOptionValue<GncMultiChoiceOptionChoices> because having the
vector as the value obviously wouldn't work and besides it needs
additional functions.
2021-07-10 17:24:57 -07:00
John Ralls
d544f85256 Replace boost::variant and boost::optional with the C++17 std equivs. 2021-07-10 17:24:57 -07:00
John Ralls
694a15ed21 Extract SCM GncOptionDB::lookup_option to gnc-optiondb.i. 2021-07-10 17:24:57 -07:00
John Ralls
9cdcaf0da8 Remove GncOptionDB::set_selectable and convert set_option to a template. 2021-07-10 17:24:57 -07:00
John Ralls
c5fac51a8b Change the type of OptionUIItem's m_ui_item from void* to GncOptionUIItem.
A locally-opaque class wrapping whatever sort of widget ptr one needs.
Thanks, warlord!
2021-07-10 17:24:56 -07:00
John Ralls
3296212aef Sketch out the rest of the option types.
Minimal implentation to get it to compile and pass tests, not functional yet.
2021-07-10 17:24:56 -07:00
John Ralls
4146251cc7 Add GncOptionUIItem manipulation to GncOptionDB. 2021-07-10 17:24:56 -07:00
John Ralls
94628097e4 Use GncOptionUIType parameters in gnc_register_option functions. 2021-07-10 17:24:56 -07:00
John Ralls
3769a356d5 Extract functions find_section and find_option using boost::optional
to handle not-found condition.
2021-07-10 17:24:56 -07:00
John Ralls
cf0b1da4fa Remove GncOptionWrapper.
Move the GncOptions into the GncOptionDB. This works with tests but
might not with real reports.
2021-07-10 17:24:56 -07:00
John Ralls
d2655d3fb0 Remove gnc-option-db business convenience functions.
gnc_option_db_lookup_invoice_option used only once, so moved its
guts there. The others weren't used at all.
2021-07-10 17:24:56 -07:00
John Ralls
f3eee511e8 Add free functions to create a new GncOptionDB and to register options.
The objective of the free functions is to hide the GncOption from language
bindings so that the GncOptions can be moved into the GncOptionDB instead
of having shared ptrs splattered around the heap. Nearly all access to
the options can then be mediated through the GncOptionDB container.

Note that gnc_option_db_new creates the GncOptionDB on the heap and
returns a raw ptr, so it's up to the creator of the GncOptionDB to
call delete on it when it's no longer needed.
2021-07-10 17:24:56 -07:00
John Ralls
455d3c2d60 Add GncOptionDB class. 2021-07-10 17:24:56 -07:00