[kmobiletools] KDE/kdepim/kmobiletools

Volker Krause vkrause at kde.org
Thu Jun 21 20:44:13 CEST 2007


On Thursday 21 June 2007 14:56:51 Frank Osterfeld wrote:
> On Thursday 21 June 2007 14:15:50 Marco Gulino wrote:
> >  KDateTime SMS::getDateTime() const {
> >      if(! const_cast<SMS*>(this)->hasHeader("Date") ) return KDateTime();
> > -    return (dynamic_cast<KMime::Headers::Date*>(
> > -        const_cast<SMS*>(this)->getHeaderByType("Date"))
> > -            )->dateTime();
> > +    return (const_cast<SMS*>(this)->date() )->dateTime();
> >  }
>
> hasHeader() and friends should probably become const in kmime, so one can
> avoid this ugly const_cast mess?

Yes. Unfortunately this requires quite some work since there is a whole chain 
of non-const methods that needs to be changed and some of these modify 
private members (eg. create a header object on demand, etc).

Also, we are seeing this const_cast mess in basically every Akonadi serializer 
plugin. So, we might want to reconsider the constness of these methods as 
well.

regards
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmobiletools/attachments/20070621/d18497ad/attachment-0001.pgp 


More information about the kmobiletools mailing list