Proposed new KDateTime class

Tobias Koenig tokoe at kde.org
Wed Nov 16 00:41:20 GMT 2005


On Tue, Nov 15, 2005 at 01:17:42PM +0000, David Jarvie wrote:
> On Mon, Nov 14 2005 at 11:06, Tobias Koenig wrote:
Hi David,

> >Yes, they are. In 4.0 we'd like to be able to serialize libkcal objects,
> >so a serializer for a datetime class is a must.
> 
> That would require a serialiser for the KTimezone class (which is one of the private 
> components of KDateTime). KTimezone is polymorphic, so you couldn't have
>     operator>>(QDataStream&, KTimezone&)
> because the memory size required by the KTimezone object would be unknown.
The class KTimezone could offer a method
  KTimezone::toStream( QDataStream &stream );
and
  KTimezone::fromStream( const QDataStream &stream );
which are reimplemented by the subclasses.

In operator>>( QDataStream &stream, KDateTime &dateTime ) you would call
  dateTime->mTimezone->fromStream( stream );

> instead, with the serialisation method constructing a new KTimezone of the appropriate class, 
> and returning a pointer to it. The problem then would be how operator>>() would be able to 
> determine which KTimezone sub-class was contained in the QDataStream, given that it doesn't 
> know what classes may in the future be derived from it.
We can use enums for the subclasses. Isn't there a limited number of
possible timezones anyway?

Ciao,
Tobias
-- 
Separate politics from religion and economy!
The Councile of the European Union is an undemocratic and illegal institution!

	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de





More information about the kde-core-devel mailing list