Hi,
I'm hesitating which way to go of the two I've found out.
case is that I have to store some options data about the data which my
program tackles with. I also must include the ability to edit these
options, and to write/load them at save/load.
In an alpha version I've written in simple C, I've simply used a
struct to accomodate my functions, then some char *[] to store the
options, and #define s for them so I could easily handle the options
when needed. this is the first way to go, and has the greeeeaaaat
advantage of that I can simply dump/load this struct into my project
file (which I need to do), with simple binary file handling. it was
easy since I could have fixed len char* for strings, so I could
read/write at once with a sizeof() arg. furthermore, this way I could
make a copy of this struct, and use it for dialogs - easy go back with
cancels and invalid data.
other way I've found out is to make a class for the options, and
accomodate the option defs in its constructor. this way I can still
have multiple copies of it. however, I cannot simply dump the data
area of it (or can I?) so I'd have to write a saving function for it.
furthermore, I'm using a file I/O class so I can easily and separately
do data import/export, load/save. then I'd have to put my options
saving function in the I/O class, which would ruin the benefits of
having these options in a separate module (.h/.cpp pair)...
furthermore, this way I should use wxString s (I'm using wxwidgets) to
store my strings, which again would ruin my simpe I/O of options. I'm
afraid this brings more headache than any advantages, if any, but I
might not be seeing them...
going with wxOptions is just not fine for me, so had dropped that way
at the beginning...
what do you suggest, how should I solve this? (I'm quite new to C++
and OOP, previously had only experience with function programming...)
tia,
tom
--
Coupe Quattro '89
Typ81 custom '84
|