Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"+" and "-" for options set

24 views
Skip to first unread message

Alf P. Steinbach

unread,
May 23, 2018, 8:56:45 AM5/23/18
to
The notation is still ugly, but I got an insight: that one may need to
remove/cancel an option from a base class. Then for expressing an
options set "+" and "-" work better than "|". The notation is still ugly
though, involving verbose "using" statements to avoid even worse verbosity:

Main_window()
: Top_level_window{ L"The new main window" }
{
using Ed = winapi::gui::Edit_control;
using Opt = Ed::Options;
using Ft = name::Features;
using cppx::options_shortname::_;
const ptr_<Ed> edit = make_new<Ed>( *this, Opt{} + _<Ft>(
Ed::multiline ) );
MoveWindow( *edit, 10, 10, 640, 400, false );
}

Here the "name::Features" (a pointer type in a namespace) is the way to
express a name for a value, so that one can have, say, various integer
values that denote different things.

A less verbose alternative could perhaps be to require a separate type,
maybe a boxing type, for each rôle of type's values?

Ideas?


Cheers!,

- Alf

Öö Tiib

unread,
May 24, 2018, 2:37:23 PM5/24/18
to
List of deviations from defaults can perhaps be passed to constructor of
widget as initializer list parameter. Initializer lists are annoyingly
loose but might work in such situation.

Modern GUIs (mobile-app-ready) have gone complex. Designers of GUI expect
CADs. There is always some sort of (hard to read and to merge to repo)
resource script. About the few lucky cases where it has to be built
with code (say for some nifty animation) no one cares how ugly the code
looks. So ... don't worry. ;)
0 new messages