New methods for KTimeZone

David Jarvie lists at astrojar.org.uk
Sat Jun 9 18:21:12 BST 2007


On Saturday 09 June 2007 16:00:21 Thiago Macieira wrote:
> David Jarvie wrote:
> >I'd like to add a couple of new methods to KTimeZone on Monday, and
> > provide additional optional parameters for a couple of other methods.
> > Their purpose is to fetch details of time zone daylight savings
> > transitions during specified time intervals. There is a need for this
> > in reading iCalendar data in kdepim, but they are generally applicable
> > so it seems sensible to add them to kdelibs before the API freeze.
> >
> >Patch attached - and I'll also add test code. Any objections?
>
> Hijacking your thread:
>
> Can we get rid of these:
>
> (kdecore/date/kdatetime.cpp:201 and 202)
> const KDateTime::Spec KDateTime::Spec::UTC       =
> KDateTime::Spec(KDateTime::UTC);
> const KDateTime::Spec KDateTime::Spec::ClockTime =
> KDateTime::Spec(KDateTime::ClockTime);
>
> They are non-POD global statics. That we can't have. Please either make
> them enums or functions or POD objects.

Okay, I'll fix these.

> Also, the following two functions:
> KDateTime::Spec       KDateTime::Spec::LocalZone()                   {
> return Spec(KDateTime::LocalZone); }
> KDateTime::Spec       KDateTime::Spec::OffsetFromUTC(int utcOffset)  {
> return Spec(KDateTime::OffsetFromUTC, utcOffset); }
>
> are out of the API style guidelines because they begin with a capital
> letter.

Yes, they vary from the style guidelines, but for a reason. There are two 
public constant data members (the two non-POD items you mention above) and 
these two methods, all of which have the same names as the 
KDateTime::SpecType enum members. They have the same names so as to indicate 
the close connection between them and the enum members.

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm




More information about the kde-core-devel mailing list