John Ralls
883127a59d
Implement operators >> and << on GncOption.
2021-07-10 17:24:57 -07:00
John Ralls
e583c84f4e
Clean up comments for GncOptionDateValue.
2021-07-10 17:24:57 -07:00
John Ralls
aaf6b14c67
Remove commented-out code.
2021-07-10 17:24:57 -07:00
John Ralls
1b00399b14
Remove GncOptionValue<std::Vector<GncGUID>>.
...
This going to be the Account List option implementation, but a more
customized approach is better.
2021-07-10 17:24:57 -07:00
John Ralls
5a9c4ccaf8
Clean out copies of the option.scm comments used as a development guide.
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
7183e7c43a
Fix begin/end of quarter calculations.
...
Set the period to the calendar year if it's not set in prefs.
Handle correctly the FY start month being after the current month.
2021-07-10 17:24:57 -07:00
John Ralls
399573a89d
Fix multichoice test construction.
2021-07-10 17:24:57 -07:00
John Ralls
12c5b94430
New scheme function gnc_option_default_value.
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
2f2ac99944
Replace the direct wrapping of GncOptionDB-set-option-string-foo.
...
With a simple type-free function gnc_option_set. This mirrors the current
(gnc:option-set(gnc:lookup-option... and takes care of SCM type conversion.
2021-07-10 17:24:57 -07:00
John Ralls
252ba9b477
Change GncOptionDB::lookup_option to gnc_option_value().
...
The old gnc:lookup-option returned the option object so that it could be
manipulated rather than getting its value; gnc_option_value replicates
the behavior of (gnc:option-value (gnc:lookup-option)).
2021-07-10 17:24:57 -07:00
John Ralls
ff7b263a5f
Fix up and test the int specialization of GncOptionRangeValue.
...
Not sure yet that a double one is really needed.
2021-07-10 17:24:57 -07:00
John Ralls
39b7c9c74d
Convert scm_from_value() to templates for stricter overload resolution.
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
8eedcb6d6d
Extract all SCM functions to gnc-optiondb.i.
...
So that it can be moved to bindings/ when gnc-module-load-begone is ready.
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
16d1f0655b
Get libswig-gnc-optiondb to install in the right place on Windows.
2021-07-10 17:24:57 -07:00
John Ralls
cee3cdaff9
Instantiate GncOption::set_option for guile, initial types string and int.
...
For proof-of-concept. Guile obviously doesn't know about templates.
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
935ce6db99
Move the SCM option value conversion from the GncOptionValue classes to GncOption.
2021-07-10 17:24:57 -07:00
John Ralls
e51faff3e3
Throw an exception if one tries to set a GncOption with an unsupported type.
2021-07-10 17:24:56 -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
0a13b4c518
Fix up the SWIG wrapper for GncOptionDBPtr.
...
Thanks to Flexo@stackoverflow for
https://stackoverflow.com/questions/27693812/how-to-handle-unique-ptrs-with-swig
5 years later, why isn't this in SWIG 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
6ccb9dbb9e
Use a std::unique_ptr<GncOptionDB> instead of a raw ptr.
...
Passing references to it to the gnc_register_option functions.
Not tested yet with SWIG, might not work.
Includes introducing fixtures to gtest-gnc-optiondb.cpp.
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
6deedd441f
Make the ptr returned by GncOption::get_ui_item() const
...
but not the GtkWidget it points to.
2021-07-10 17:24:56 -07:00
John Ralls
40361ec854
gnc-opption.hpp needs to include <functional>.
2021-07-10 17:24:56 -07:00
John Ralls
41ef2c5d44
Add OptionUIItem composition class to GncOption.
...
Provides a type and a raw pointer member with accessors. The type is one of
enum GncOptionIUType and is either VOID (for internal options that don't
get UI items) or one of the widget types specified in dialog-option.c or
business-options-gnome.c.
2021-07-10 17:24:56 -07:00
John Ralls
083e5b93df
Replace the CRTP class GncOptionBase with direct calls in its former children.
...
Benefit of CRTP too limited to accept the cost of understanding it.
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
2ee0edaa16
Use targets instead of variables for GncOption* tests.
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
ade7fc8b6e
Initial SWIG of GncOptionDB and Scheme tests.
...
This class will be heavily used by reports so we need to ensure SWIG and
Scheme compatibility from the start.
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
John Ralls
16fd632ec8
Make the GncOption member variables private.
...
GncOption is intended to be final, so there's no point in protected members.
2021-07-10 17:24:56 -07:00
John Ralls
13b94d2370
Test integer options, calling get_value with wrong type.
2021-07-10 17:24:56 -07:00
John Ralls
d88ec0dc1b
Replace the gnc_make_foo_option free functions with a template ctor.
...
The free functions will reappear for GncOptionDB. This is to avoid
having to pass naked pointers to Scheme with the attendant object
lifetime issues.
2021-07-10 17:24:56 -07:00
John Ralls
01dc70cc60
Add GncOption accessors for Classifier strings.
2021-07-10 17:24:56 -07:00
John Ralls
01fcae6ac8
Make the OptionClassifier members non-const.
...
Constness deletes the default copy assignment operator, making GncOption
not copy-assignable.
2021-07-10 17:24:56 -07:00
John Ralls
b6fd844774
Wrap GncOptionValue/GncOptionValidatedValue in Boost::Variant.
...
To provide a single type for containers.
2021-07-10 17:24:56 -07:00
John Ralls
c0ba3e2706
[C++ Options] Begin Implementation for basic and validated options.
2021-07-10 17:24:56 -07:00
John Ralls
b495da4e29
[C++ Options] Remove some unused C API from options-utils.
2021-07-10 17:24:56 -07:00
John Ralls
0b77641e9f
Remove gnc_options_dialog bindings from gnome-utils.i.
...
They're unused.
2021-07-10 17:24:56 -07:00