mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-24 10:52:52 +00:00
173 lines
7.3 KiB
Text
173 lines
7.3 KiB
Text
//
|
|
// Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
|
|
// Earlier copyrights 1998 - 2007 Jim Bublitz also apply
|
|
|
|
// Generated by twine
|
|
|
|
// This file is part of PyKDE4.
|
|
|
|
// PyKDE4 is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
// published by the Free Software Foundation; either version 2.1 of
|
|
// the License, or (at your option) any later version.
|
|
|
|
// PyKDE4 is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
class KDateTime
|
|
{
|
|
%TypeHeaderCode
|
|
#include <kdatetime.h>
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
enum SpecType
|
|
{
|
|
Invalid,
|
|
UTC,
|
|
OffsetFromUTC,
|
|
TimeZone,
|
|
LocalZone,
|
|
ClockTime
|
|
};
|
|
|
|
|
|
class Spec
|
|
{
|
|
|
|
public:
|
|
Spec ();
|
|
Spec (const KTimeZone& tz);
|
|
Spec (KDateTime::SpecType type, int utcOffset = 0);
|
|
Spec (const KDateTime::Spec& spec);
|
|
bool isValid () const;
|
|
KTimeZone timeZone () const;
|
|
KDateTime::SpecType type () const;
|
|
bool isLocalZone () const;
|
|
bool isClockTime () const;
|
|
bool isUtc () const;
|
|
bool isOffsetFromUtc () const;
|
|
int utcOffset () const;
|
|
void setType (KDateTime::SpecType type, int utcOffset = 0);
|
|
void setType (const KTimeZone& tz);
|
|
bool operator == (const KDateTime::Spec& other) const;
|
|
bool operator != (const KDateTime::Spec& other) const;
|
|
bool equivalentTo (const KDateTime::Spec& other) const;
|
|
static KDateTime::Spec UTC ();
|
|
static KDateTime::Spec ClockTime ();
|
|
static KDateTime::Spec OffsetFromUTC (int utcOffset);
|
|
static KDateTime::Spec LocalZone ();
|
|
~Spec ();
|
|
};
|
|
// Spec
|
|
|
|
|
|
|
|
enum TimeFormat
|
|
{
|
|
ISODate,
|
|
RFCDate,
|
|
RFCDateDay,
|
|
QtTextDate,
|
|
LocalDate,
|
|
RFC3339Date
|
|
};
|
|
|
|
|
|
enum Comparison
|
|
{
|
|
Before,
|
|
AtStart,
|
|
Inside,
|
|
AtEnd,
|
|
After,
|
|
Equal,
|
|
Outside,
|
|
StartsAt,
|
|
EndsAt
|
|
};
|
|
|
|
KDateTime ();
|
|
explicit KDateTime (const QDate& date, const KDateTime::Spec& spec = KDateTime::Spec(KDateTime::LocalZone));
|
|
KDateTime (const QDate& date, const QTime& time, const KDateTime::Spec& spec = KDateTime::Spec(KDateTime::LocalZone));
|
|
KDateTime (const QDateTime& dt, const KDateTime::Spec& spec);
|
|
explicit KDateTime (const QDateTime& dt);
|
|
KDateTime (const KDateTime& other);
|
|
bool isNull () const;
|
|
bool isValid () const;
|
|
bool isDateOnly () const;
|
|
QDate date () const;
|
|
QTime time () const;
|
|
QDateTime dateTime () const;
|
|
KTimeZone timeZone () const;
|
|
KDateTime::Spec timeSpec () const;
|
|
KDateTime::SpecType timeType () const;
|
|
bool isLocalZone () const;
|
|
bool isClockTime () const;
|
|
bool isUtc () const;
|
|
bool isOffsetFromUtc () const;
|
|
int utcOffset () const;
|
|
bool isSecondOccurrence () const;
|
|
KDateTime toUtc () const;
|
|
KDateTime toOffsetFromUtc () const;
|
|
KDateTime toOffsetFromUtc (int utcOffset) const;
|
|
KDateTime toLocalZone () const;
|
|
KDateTime toClockTime () const;
|
|
KDateTime toZone (const KTimeZone& zone) const;
|
|
KDateTime toTimeSpec (const KDateTime::Spec& spec) const;
|
|
KDateTime toTimeSpec (const KDateTime& dt) const;
|
|
uint toTime_t () const;
|
|
void setTime_t (qint64 seconds);
|
|
void setDateOnly (bool dateOnly);
|
|
void setDate (const QDate& date);
|
|
void setTime (const QTime& time);
|
|
void setDateTime (const QDateTime& dt);
|
|
void setTimeSpec (const KDateTime::Spec& spec);
|
|
void setSecondOccurrence (bool second);
|
|
KDateTime addMSecs (qint64 msecs) const;
|
|
KDateTime addSecs (qint64 secs) const;
|
|
KDateTime addDays (int days) const;
|
|
KDateTime addMonths (int months) const;
|
|
KDateTime addYears (int years) const;
|
|
int secsTo (const KDateTime& other) const;
|
|
qint64 secsTo_long (const KDateTime& other) const;
|
|
int daysTo (const KDateTime& other) const;
|
|
static KDateTime currentLocalDateTime ();
|
|
static KDateTime currentUtcDateTime ();
|
|
static KDateTime currentDateTime (const KDateTime::Spec& spec);
|
|
static QDate currentLocalDate ();
|
|
static QTime currentLocalTime ();
|
|
QString toString (const QString& format) const;
|
|
QString toString (KDateTime::TimeFormat format = KDateTime::ISODate) const;
|
|
static KDateTime fromString (const QString& string, KDateTime::TimeFormat format = KDateTime::ISODate, bool* negZero /Out/ = 0);
|
|
static KDateTime fromString (const QString& string, const QString& format, const KTimeZones* zones = 0, bool offsetIfAmbiguous = 1);
|
|
static void setFromStringDefault (const KDateTime::Spec& spec);
|
|
bool outOfRange () const;
|
|
KDateTime::Comparison compare (const KDateTime& other) const;
|
|
bool operator == (const KDateTime& other) const;
|
|
bool operator != (const KDateTime& other) const;
|
|
bool operator < (const KDateTime& other) const;
|
|
bool operator <= (const KDateTime& other) const;
|
|
bool operator > (const KDateTime& other) const;
|
|
bool operator >= (const KDateTime& other) const;
|
|
void detach ();
|
|
static void setSimulatedSystemTime (const KDateTime& newTime);
|
|
static KDateTime realCurrentLocalDateTime ();
|
|
//ig QDataStream& operator << (QDataStream& out, const KDateTime& dateTime);
|
|
//ig QDataStream& operator >> (QDataStream& in, KDateTime& dateTime);
|
|
~KDateTime ();
|
|
};
|
|
// KDateTime
|
|
//ig QDataStream& operator << (QDataStream& out, const KDateTime::Spec& spec);
|
|
//ig QDataStream& operator >> (QDataStream& in, KDateTime::Spec& spec);
|
|
//ig QDataStream& operator << (QDataStream& out, const KDateTime& dateTime);
|
|
//ig QDataStream& operator >> (QDataStream& in, KDateTime& dateTime);
|