
28 Mar
2007
28 Mar
'07
6:58 a.m.
Nope. Your dialog manager would keep track of the unit and set appropriately upon initialization and/or user interaction. Your reader would then be as simple as setting the value directly to the quantity. Alternatively you might have something like this:
quantity<abstract> on_dialog_ok() { quantity<abstract> dist; dist.set_unit(combo.selected_item().data()); dist.set_value(entry.value().as_double()); }
No more switch statement smell.
Yes, but then again, the unit of "dist" cannot be hardcoded in its C++ type anymore. I may be missing something, but I do not see how the above code could be made to work with the library under review. Yours, Martin.