change bool to enum : KUrl

Olivier Goffart ogoffart at kde.org
Tue May 2 15:31:12 BST 2006


Le Mardi 2 Mai 2006 15:49, David Faure a écrit :
> On Tuesday 02 May 2006 00:44, Olivier Goffart wrote:
> > +  enum CleanPathOption
> > +  {
> > +    /**
> > +     * if set, occurences of consecutive directory separators
> > +     * (e.g. /foo//bar) are cleaned up as well.  (set by default)
> > +     */
> > +    CleanDirSeparator = 0x01,
> > +    
> > +    /**
> > +     * The opposite of CleanDirSeparator.
> > +     */
> > +    LeaveDirSeparator = 0x00
> > +  };
> > +  
> > +  Q_DECLARE_FLAGS(CleanPathOptions,CleanPathOption)
>
> This one is not really a "flag" (as in "one or the other or both"), is it?
> It seems to be a standard enum instead; except that the type safety that
> QFlag gives is nice, of course. Does Qt provide a way to declare a
> "typesafe enum"?

AFAIK, C++ enum are already type safe,  even more than QFlags which accept 0 
(or false)

I Made a QFlags here to be able to eventually estand it later.


> At least this line is wrong:
> + Q_DECLARE_OPERATORS_FOR_FLAGS(KUrl::CleanPathOptions);
> since LeaveDirSeparator | CleanDirSeparator  would make no sense.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060502/604e7240/attachment.sig>


More information about the kde-core-devel mailing list