RFC: bool operators for some classes

Carsten Pfeiffer carpdjih at mailbox.tu-berlin.de
Fri Jan 3 01:49:09 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----

On Friday 03 January 2003 02:04, Malte Starostik wrote:

> If those classes provided a boolean conversion, the above could be written
> more tersely:
>
> if ( KFileMetaInfoItem artist = metaInfo.item( KFileMimeTypeInfo::Author ) )
[...]
> which ain't only shorter but also scopes those variables more
> appropriately. So I'd like to suggest the addition of

I for one don't like boolean operators on classes very much because they're 
not intuitive to use or understand (what if a KFileMetaInfo object is NOT? :)

What's wrong with
if ( (KFileMetaInfoItem artist = 
      metaInfo.item( KFileMimeTypeInfo::Author ) ).isValid() )

Cheers
Carsten Pfeiffer
-----BEGIN PGP SIGNATURE-----

iQEVAwUBPhTsF6WgYMJuwmZtAQE5SAf+Mi0IkwsTg5iHuON8R2k0XpyOnlFFKTK0
dEODLyNsGAVaucsMB8cswSNb2MiBeD8tlAsTum9/LCCu6ms4OotIknxnfmNfc+1h
2UBAV/RRFS7e2TREglGazgPtZ858LIZmBNynaFZw/CTjGHi8NxYpAyJsEc7vb4FP
zeXJ4RGxgG05Lo71smxtb9q8GT5Umd/m412OuPc8SYtOIviW2AhKJL1stDiAFB9d
5pF0KBB9rk13wKOlHGjAQVOXfJM4ncvTbk2qXusbaU8q6aMETif6pHixbJIXhpCd
f0JnwRFXP+x/3xBf4L9OJIANl5VhXJoa/SirEBoh/vZ+3dO1geahWQ==
=SvC1
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list