Patternist::AbstractDateTime Class Reference
[XQuery/XPath Data Model]

Base class for classes implementing values related to time, date or both. More...

#include <AbstractDateTime.h>

Inheritance diagram for Patternist::AbstractDateTime:

Inheritance graph
[legend]
Collaboration diagram for Patternist::AbstractDateTime:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { DefaultYear = 2000, DefaultMonth = 1, DefaultDay = 1 }
typedef PlainSharedPtr< AbstractDateTimePtr

Public Member Functions

 AbstractDateTime (const KDateTime &dateTime)
QString dateToString () const
virtual Item::Ptr fromValue (const KDateTime &dt) const
QString timeToString () const
virtual KDateTime toDateTime () const

Static Public Member Functions

static bool isRangeValid (const QDate &date, QString &message)
static QString serializeMSeconds (const MSecondProperty msecs)

Protected Member Functions

QString zoneOffsetToString () const

Static Protected Member Functions

static KDateTime create (AtomicValue::Ptr &errorMessage, const QString &lexicalSource, const CaptureTable &captTable)

Protected Attributes

const KDateTime m_datetime

Classes

class  CaptureTable
 Acts as a mapping table for AbstractDateTime::create() and describes where certain fields in a QRegExp pattern can be found for a particular W3C XML Schema date/time type. More...

Detailed Description

Base class for classes implementing values related to time, date or both.

See also:
XML Schema Part 2: Datatypes Second Edition, 3.2.7 dateTime

XQuery 1.0 and XPath 2.0 Data Model (XDM), 3.3.2 Dates and Times

A summary of the international standard date and time notation, Markus Kuhn

ISO 8601, From Wikipedia, the free encyclopedia

Author:
Frans Englich <frans.englich@telia.com>

Definition at line 38 of file AbstractDateTime.h.


Member Typedef Documentation

typedef PlainSharedPtr<AbstractDateTime> Patternist::AbstractDateTime::Ptr

A smart pointer wrapping AtomicValue instances.

Reimplemented from Patternist::AtomicValue.

Reimplemented in Patternist::Date, Patternist::DateTime, Patternist::GDay, Patternist::GMonth, Patternist::GMonthDay, Patternist::GYear, Patternist::GYearMonth, and Patternist::Time.

Definition at line 41 of file AbstractDateTime.h.


Member Function Documentation

QString AbstractDateTime::dateToString (  )  const

Returns:
m_datetime's date part converted to string. This is for example "2004-05-12" or "-2004-05-12".

Definition at line 241 of file AbstractDateTime.cpp.

References m_datetime, and KDateTime::toString().

Referenced by Patternist::DateTime::stringValue(), and Patternist::Date::stringValue().

Here is the call graph for this function:

Here is the caller graph for this function:

Item::Ptr AbstractDateTime::fromValue ( const KDateTime dt  )  const [virtual]

A factory function for creating instances that are of the dynamic type of this class, that represents dt.

The default implementation performs an assert() call. This function is not pure virtual because all sub-classes do not use it.

Reimplemented in Patternist::Date, Patternist::DateTime, and Patternist::Time.

Definition at line 296 of file AbstractDateTime.cpp.

bool AbstractDateTime::isRangeValid ( const QDate &  date,
QString &  message 
) [static]

Determines whether dt is a date-time that can be represented, and isn't too early or too late. If it is valid, true is returned. Otherwise, false is returned and message is set to contain a translated message for human consumption, describing the error.

Definition at line 229 of file AbstractDateTime.cpp.

Referenced by Patternist::DateTimeDurationMathematician::calculate().

Here is the caller graph for this function:

QString AbstractDateTime::serializeMSeconds ( const MSecondProperty  msecs  )  [static]

Serializes the milli seconds msecs into a string representation. For example, if msecs is 1, ".001" is returned; if msecs is 100 then is ".1" returned.

Definition at line 246 of file AbstractDateTime.cpp.

Referenced by Patternist::Duration::stringValue(), Patternist::DayTimeDuration::stringValue(), and timeToString().

Here is the caller graph for this function:

QString AbstractDateTime::timeToString (  )  const

Returns:
m_datetime's time part converted to string. This is for example "12" or "01.023".

Definition at line 264 of file AbstractDateTime.cpp.

References m_datetime, serializeMSeconds(), KDateTime::time(), and KDateTime::toString().

Referenced by Patternist::Time::stringValue(), and Patternist::DateTime::stringValue().

Here is the call graph for this function:

Here is the caller graph for this function:

KDateTime AbstractDateTime::toDateTime (  )  const [virtual]

Returns:
the date time this class represents, as a KDateTime.

Definition at line 291 of file AbstractDateTime.cpp.

References m_datetime.

QString AbstractDateTime::zoneOffsetToString (  )  const [protected]

Returns:
m_datetime' zone offset converted to string, as per the the W3C XML Schema types. This is for example "Z" or "+12.00"(depending on m_datetime).

Definition at line 275 of file AbstractDateTime.cpp.

References KDateTime::ClockTime, m_datetime, KDateTime::timeType(), KDateTime::toString(), and KDateTime::UTC.

Referenced by Patternist::Time::stringValue(), Patternist::GYearMonth::stringValue(), Patternist::GYear::stringValue(), Patternist::GMonthDay::stringValue(), Patternist::GMonth::stringValue(), Patternist::GDay::stringValue(), Patternist::DateTime::stringValue(), and Patternist::Date::stringValue().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Feb 8 14:54:31 2007 for Patternist by  doxygen 1.5.1