Re: naming conventions

"J. Perkins" <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <[email protected]>
Robert Roebling wrote:
> namespace wx
> {
>     const int ALIGN_RIGHT = 0x0008;
>     const int wxALIGN_RIGHT = ALIGN_RIGHT;
> }

I'm all for providing multiple names for things. I would even add 
"AlignRight" to that list, just to be more C# friendly.

The problem is that these need to be defined within a class or enum, so 
we need to have some leading name. 'wx' makes the most sense, but it's 
also in the 'wx' namespace, so you end up with 'wx.wx.ALIGN_RIGHT'.

I don't know. There may not be an elegant solution that still maintains 
the wxWin API "look-and-feel". The options appear to be:


#1: Put all constants in a big enum:

   enum wx
   {
      SOME_WINDOW_STYLE,
      SOME_DIALOG_STYLE,
      ...
   };

   Use as (wx.SOME_WINDOW_STYLE | wx.SOME_DIALOG_STYLE)


#2: Put constants in categories, enforced by a class name, but make make 
them int constants so they can be easily combined (this is what I tried 
with the WindowStyle, DialogStyle, etc. classes.

   class WindowStyle
   {
      public const int SOME_WINDOW_STYLE;
      ...
   }

   class DialogStyle : WindowStyle
   {
      public const int SOME_DIALOG_STYLE;
      ...
   }

   Use as (DialogStyle.SOME_WINDOW_STYLE | DialogStyle.SOME_DIALOG_STYLE)


#3: Something else???


Jason
379





-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.