Qt 4.8
Public Types | Public Functions | Static Public Functions | Protected Functions | Friends | List of all members
QPatternist::DateTime Class Reference

Implements the value instance of the xs:dateTime type. More...

#include <qschemadatetime_p.h>

Inheritance diagram for QPatternist::DateTime:
QPatternist::AbstractDateTime QPatternist::AtomicValue QSharedData QPatternist::CppCastingHelper< AtomicValue >

Public Types

typedef AtomicValue::Ptr Ptr
 
- Public Types inherited from QPatternist::AbstractDateTime
enum  { DefaultYear = 2000, DefaultMonth = 1, DefaultDay = 1 }
 
typedef QExplicitlySharedDataPointer< AbstractDateTimePtr
 
- Public Types inherited from QPatternist::AtomicValue
typedef QList< AtomicValue::PtrList
 
typedef QExplicitlySharedDataPointer< AtomicValuePtr
 

Public Functions

virtual Item fromValue (const QDateTime &dt) const
 
virtual QString stringValue () const
 
virtual ItemType::Ptr type () const
 
- Public Functions inherited from QPatternist::AbstractDateTime
 AbstractDateTime (const QDateTime &dateTime)
 
QString dateToString () const
 
QString timeToString () const
 
const QDateTimetoDateTime () const
 
- Public Functions inherited from QPatternist::AtomicValue
virtual bool evaluateEBV (const QExplicitlySharedDataPointer< DynamicContext > &context) const
 
virtual bool hasError () const
 
virtual ~AtomicValue ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 
- Public Functions inherited from QPatternist::CppCastingHelper< AtomicValue >
const TCastTarget * as () const
 
TCastTarget * as ()
 

Static Public Functions

static DateTime::Ptr fromDateTime (const QDateTime &dt)
 
static DateTime::Ptr fromLexical (const QString &string)
 
- Static Public Functions inherited from QPatternist::AbstractDateTime
static bool isRangeValid (const QDate &date, QString &message)
 
static QString serializeMSeconds (const MSecondProperty msecs)
 
- Static Public Functions inherited from QPatternist::AtomicValue
static ItemType::Ptr qtToXDMType (const QXmlItem &item)
 
static QVariant toQt (const AtomicValue *const value)
 
static QVariant toQt (const AtomicValue::Ptr &value)
 
static Item toXDM (const QVariant &value)
 

Protected Functions

 DateTime (const QDateTime &dateTime)
 
- Protected Functions inherited from QPatternist::AbstractDateTime
QString zoneOffsetToString () const
 
- Protected Functions inherited from QPatternist::AtomicValue
 AtomicValue ()
 
- Protected Functions inherited from QPatternist::CppCastingHelper< AtomicValue >
 CppCastingHelper ()
 

Friends

class CommonValues
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 
- Static Protected Functions inherited from QPatternist::AbstractDateTime
static void copyTimeSpec (const QDateTime &from, QDateTime &to)
 Makes the QDateTime::timeSpec() and QDateTime::zoneOffset() of ot * consistent to from. More...
 
static QDateTime create (AtomicValue::Ptr &errorMessage, const QString &lexicalSource, const CaptureTable &captTable)
 
- Protected Variables inherited from QPatternist::AbstractDateTime
const QDateTime m_dateTime
 

Detailed Description

Implements the value instance of the xs:dateTime type.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 76 of file qschemadatetime_p.h.

Typedefs

◆ Ptr

Definition at line 79 of file qschemadatetime_p.h.

Constructors and Destructors

◆ DateTime()

DateTime::DateTime ( const QDateTime dateTime)
protected

Definition at line 51 of file qschemadatetime.cpp.

Referenced by fromDateTime(), and fromLexical().

51  : AbstractDateTime(dateTime)
52 {
53 }
AbstractDateTime(const QDateTime &dateTime)

Functions

◆ fromDateTime()

DateTime::Ptr DateTime::fromDateTime ( const QDateTime dt)
static

Definition at line 95 of file qschemadatetime.cpp.

Referenced by QPatternist::AbstractDateTimeToDateTimeCaster::castFrom(), QPatternist::AdjustDateTimeToTimezoneFN::createValue(), QPatternist::DateTimeFN::evaluateSingleton(), QPatternist::CurrentDateTimeFN::evaluateSingleton(), fromValue(), and QPatternist::AtomicValue::toXDM().

96 {
97  Q_ASSERT(dt.isValid());
98  return DateTime::Ptr(new DateTime(dt));
99 }
AtomicValue::Ptr Ptr
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
Definition: qdatetime.cpp:2346
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
DateTime(const QDateTime &dateTime)

◆ fromLexical()

DateTime::Ptr DateTime::fromLexical ( const QString string)
static

Creates an instance from the lexical representation string.

Definition at line 55 of file qschemadatetime.cpp.

Referenced by QPatternist::StringToDateTimeCaster::castFrom().

56 {
57  static const CaptureTable captureTable( // STATIC DATA
58  /* The extra paranthesis is a build fix for GCC 3.3. */
60  "^\\s*" /* Any preceding whitespace. */
61  "(-?)" /* Any preceding minus. */
62  "(\\d{4,})" /* The year part. */
63  "-" /* Delimiter. */
64  "(\\d{2})" /* The month part. */
65  "-" /* Delimiter. */
66  "(\\d{2})" /* The day part. */
67  "T" /* Delimiter. */
68  "(\\d{2})" /* Hour part */
69  ":" /* Delimiter. */
70  "(\\d{2})" /* Minutes part */
71  ":" /* Delimiter. */
72  "(\\d{2,})" /* Seconds part. */
73  "(?:\\.(\\d+))?" /* Milli seconds part. */
74  "(?:(\\+|-)(\\d{2}):(\\d{2})|(Z))?" /* The zone offset, "+08:24". */
75  "\\s*$" /* Any whitespace at the end. */))),
76  /*zoneOffsetSignP*/ 9,
77  /*zoneOffsetHourP*/ 10,
78  /*zoneOffsetMinuteP*/ 11,
79  /*zoneOffsetUTCSymbolP*/ 12,
80  /*yearP*/ 2,
81  /*monthP*/ 3,
82  /*dayP*/ 4,
83  /*hourP*/ 5,
84  /*minutesP*/ 6,
85  /*secondsP*/ 7,
86  /*msecondsP*/ 8,
87  /*yearSignP*/ 1);
88 
89  AtomicValue::Ptr err;
90  const QDateTime retval(create(err, lexical, captureTable));
91 
92  return err ? err : DateTime::Ptr(new DateTime(retval));
93 }
AtomicValue::Ptr Ptr
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QDateTime create(AtomicValue::Ptr &errorMessage, const QString &lexicalSource, const CaptureTable &captTable)
DateTime(const QDateTime &dateTime)
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216

◆ fromValue()

Item DateTime::fromValue ( const QDateTime 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 from QPatternist::AbstractDateTime.

Definition at line 101 of file qschemadatetime.cpp.

102 {
103  Q_ASSERT(dt.isValid());
104  return fromDateTime(dt);
105 }
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
Definition: qdatetime.cpp:2346
static DateTime::Ptr fromDateTime(const QDateTime &dt)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ stringValue()

QString DateTime::stringValue ( ) const
virtual

Implements QPatternist::AtomicValue.

Definition at line 107 of file qschemadatetime.cpp.

108 {
110 }
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ type()

ItemType::Ptr DateTime::type ( ) const
virtual

Implements QPatternist::AtomicValue.

Definition at line 112 of file qschemadatetime.cpp.

113 {
115 }
static const AtomicType::Ptr xsDateTime

Friends and Related Functions

◆ CommonValues

friend class CommonValues
friend

Definition at line 91 of file qschemadatetime_p.h.


The documentation for this class was generated from the following files: