comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: How best to:
Date: 1996/03/22
Date: 1996-03-22T00:00:00+00:00	[thread overview]
Message-ID: <4issd2$47p@news2.delphi.com> (raw)

In a 'cardboard thin' Ada 83 - MS Windows binding, there are a set of
window style constants which can be ORed before being passed to the API.
To reduce errors through a modicum of type checking, I'm declaring

  type Window_Styles         is private;
  type Button_Control_Styles is private;
  type Static_Control_Styles is private;
  type Listbox_Styles        is private;
  ...
  function "+"(left:Window_Styles        ; right:Window_Styles        )
    return Window_Styles        ;
  function "+"(left:Button_Control_Styles; right:Button_Control_Styles)
    return Button_Control_Styles;
  function "+"(left:Static_Control_Styles; right:Static_Control_Styles)
    return Static_Control_Styles;
  function "+"(left:Listbox_Styles       ; right:Listbox_Styles
    ) return Listbox_Styles       ;

etc.  to allow mixing general Windows_Styles with specific ones, but not
allow, eg, Button_Control_Styles to be "+" with Listbox_Styles.

When all is said and done, I wind up with nearly 500 lines.  Is there
a simpler way?

2) The package includes a set of functions of the form
  function ">="(left:Listbox_Styles; right:Window_Styles) return boolean;
to allow checking if a combined style contains a particular style (eg,
if this_style >= WS_BORDER then ...).  Is the use of ">=" for "includes"
likely to be confusing or cause problems?




                 reply	other threads:[~1996-03-22  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox