Ok() and IsOk()

Francesco Montorsi f18m_cpp217828 at yahoo.it
Tue Oct 3 16:03:15 PDT 2006


Hi all,
    I found annoying that some wx classes use the Ok() function name 
while others use IsOk()...

I've noticed that basically the classes using Ok() are the GDI objects 
and some stream classes. So I think it should be easy to deprecate the 
Ok() version doing, more or less, the following steps:

   1) s/.Ok(/.IsOk(
   2) s/->Ok(/->IsOk(
   3) s/::Ok/::IsOk
   4) s/bool Ok(/book IsOk(

   5) add to wxGDIObject and wxStreamBase the following functions:

       virtual bool IsOk() const = 0;
       wxDEPRECATE( bool Ok() const );

      (assuming all wxGDIObject-, wxStreamBase-derived classes do have 
an IsOk() function)

   6) implement the deprecated Ok() function in terms of IsOk()


if this approach reveals too simplistic (i.e. too many classes non 
wxGDIObject- or wxStreamBase-derived have Ok()), I think it shouldn't be 
too difficult to write a script which changes in the headers the:

     bool Ok() const;

occurrences into:

     bool IsOk() const;
     wxDEPRECATE( bool Ok() const );

and in a similar way the sources (adding a dummy impl for deprecated 
Ok())...

is this a crazy idea?

Francesco






More information about the wx-dev mailing list