change bool to enum : KUrl

David Faure faure at kde.org
Tue May 2 14:49:55 BST 2006


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"?

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

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list