KAlarmCal::KADateTime::Spec

KAlarmCal::KADateTime::Spec Class Reference

#include <kadatetime.h>

Public Member Functions

 Spec ()
 
 Spec (const QTimeZone &tz)
 
 Spec (SpecType type, int utcOffset=0)
 
 Spec (const Spec &spec)
 
 ~Spec ()
 
bool equivalentTo (const Spec &other) const
 
bool isLocalZone () const
 
bool isOffsetFromUtc () const
 
bool isUtc () const
 
bool isValid () const
 
bool operator!= (const Spec &other) const
 
Specoperator= (const Spec &spec)
 
bool operator== (const Spec &other) const
 
void setType (SpecType type, int utcOffset=0)
 
void setType (const QTimeZone &tz)
 
QTimeZone timeZone () const
 
SpecType type () const
 
int utcOffset () const
 

Static Public Member Functions

static Spec LocalZone ()
 
static Spec OffsetFromUTC (int utcOffset)
 
static Spec UTC ()
 

Detailed Description

The full time specification of a KADateTime instance.

This specifies how the date/time component of the KADateTime instance should be interpreted, i.e. which time zone (if any) the date/time is expressed in.

Definition at line 180 of file kadatetime.h.

Constructor & Destructor Documentation

KAlarmCal::KADateTime::Spec::Spec ( )

Constructs an invalid time specification.

Definition at line 80 of file kadatetime.cpp.

KAlarmCal::KADateTime::Spec::Spec ( const QTimeZone tz)

Constructs a time specification for a given time zone.

If tz is QTimeZone::utc(), the time specification type is set to UTC.

Parameters
tztime zone

Definition at line 86 of file kadatetime.cpp.

KAlarmCal::KADateTime::Spec::Spec ( SpecType  type,
int  utcOffset = 0 
)

Constructs a time specification.

Parameters
typetime specification type, which should not be TimeZone
utcOffsetnumber of seconds to add to UTC to get the local time. Ignored if type is not OffsetFromUTC.

Definition at line 92 of file kadatetime.cpp.

KAlarmCal::KADateTime::Spec::Spec ( const Spec spec)

Copy constructor.

Definition at line 98 of file kadatetime.cpp.

KAlarmCal::KADateTime::Spec::~Spec ( )

Destructor.

Definition at line 104 of file kadatetime.cpp.

Member Function Documentation

bool KAlarmCal::KADateTime::Spec::equivalentTo ( const Spec other) const

Checks whether this instance is equivalent to another.

The two instances are considered to be equivalent if any of the following conditions apply:

  • both instances are type OffsetFromUTC and their offsets from UTC are equal.
  • both instances are type TimeZone and their time zones are equal.
  • one instance is type TimeZone, with the time zone set to the system time zone, and the other instance is type LocalZone.
  • both instances are type LocalZone.
  • both instances are UTC. An instance is considered to be UTC if it is either type UTC, or is type OffsetFromUTC with a zero UTC offset.
Returns
true if the two instances are equivalent, false otherwise
See also
operator==()

Definition at line 218 of file kadatetime.cpp.

bool KAlarmCal::KADateTime::Spec::isLocalZone ( ) const

Returns whether the time specification follows the current local system time zone.

Returns
true if local system time zone
See also
isUtc(), isOffsetFromUtc(), timeZone()

Definition at line 196 of file kadatetime.cpp.

bool KAlarmCal::KADateTime::Spec::isOffsetFromUtc ( ) const

Returns whether the time specification is a local time at a fixed offset from UTC.

Returns
true if local time at fixed offset from UTC
See also
isLocal(), isUtc(), utcOffset()

Definition at line 200 of file kadatetime.cpp.

bool KAlarmCal::KADateTime::Spec::isUtc ( ) const

Returns whether the time specification is a UTC time.

It is considered to be a UTC time if it is either type UTC, or is type OffsetFromUTC with a zero UTC offset.

Returns
true if UTC
See also
isLocal(), isOffsetFromUtc(), timeZone()

Definition at line 168 of file kadatetime.cpp.

bool KAlarmCal::KADateTime::Spec::isValid ( ) const

Returns whether the time specification is valid.

Returns
true if valid, else false

Definition at line 192 of file kadatetime.cpp.

KADateTime::Spec KAlarmCal::KADateTime::Spec::LocalZone ( )
static

Returns a local time zone time specification.

Provided as a shorthand for KADateTime::Spec(KADateTime::LocalZone).

Returns
Local zone time specification

Definition at line 180 of file kadatetime.cpp.

KADateTime::Spec KAlarmCal::KADateTime::Spec::OffsetFromUTC ( int  utcOffset)
static

Returns a UTC offset time specification.

Provided as a shorthand for KADateTime::Spec(KADateTime::OffsetFromUTC, utcOffset).

Parameters
utcOffsetnumber of seconds to add to UTC to get the local time
Returns
UTC offset time specification

Definition at line 184 of file kadatetime.cpp.

KADateTime::Spec & KAlarmCal::KADateTime::Spec::operator= ( const Spec spec)

Assignment operator.

Definition at line 109 of file kadatetime.cpp.

bool KAlarmCal::KADateTime::Spec::operator== ( const Spec other) const

Comparison operator.

Returns
true if the two instances are identical, false otherwise
See also
equivalentTo()

Definition at line 209 of file kadatetime.cpp.

void KAlarmCal::KADateTime::Spec::setType ( SpecType  type,
int  utcOffset = 0 
)

Initialises the time specification.

Parameters
typethe time specification type. Note that TimeZone is invalid here.
utcOffsetnumber of seconds to add to UTC to get the local time. Ignored if spec is not OffsetFromUTC.
See also
type(), setType(const QTimeZone&)

Definition at line 121 of file kadatetime.cpp.

void KAlarmCal::KADateTime::Spec::setType ( const QTimeZone tz)

Sets the time zone for the time specification.

Note that setting the time zone to the current local system time zone has a different effect from setType(LocalZone), since the latter will follow changes to the system time zone.

@param tz new time zone
@see timeZone(), setType(SpecType)

Definition at line 142 of file kadatetime.cpp.

QTimeZone KAlarmCal::KADateTime::Spec::timeZone ( ) const

Returns the time zone for the date/time, according to the time specification type as follows:

  • TimeZone : the specified time zone is returned.
  • UTC : a UTC time zone is returned.
  • LocalZone : the current local time zone is returned.
Returns
time zone as defined above, or invalid in all other cases
See also
isUtc(), isLocal()

Definition at line 154 of file kadatetime.cpp.

KADateTime::SpecType KAlarmCal::KADateTime::Spec::type ( ) const

Returns the time specification type, i.e.

whether it is UTC, has a time zone, etc.

Returns
specification type
See also
isLocalZone(), isUtc(), timeZone()

Definition at line 188 of file kadatetime.cpp.

KADateTime::Spec KAlarmCal::KADateTime::Spec::UTC ( )
static

The UTC time specification.

Provided as a shorthand for KADateTime::Spec(KADateTime::UTC).

Definition at line 176 of file kadatetime.cpp.

int KAlarmCal::KADateTime::Spec::utcOffset ( ) const

Returns the UTC offset associated with the time specification.

The UTC offset is the number of seconds to add to UTC to get the local time.

Returns
UTC offset in seconds if type is OffsetFromUTC, else 0
See also
isOffsetFromUtc()

Definition at line 204 of file kadatetime.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Oct 20 2020 23:15:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.