Qt 4.8
qabstractduration_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 
52 #ifndef Patternist_AbstractDuration_H
53 #define Patternist_AbstractDuration_H
54 
55 #include <QRegExp>
56 
57 #include "qitem_p.h"
58 
60 
62 
63 namespace QPatternist
64 {
77  {
78  public:
80 
84  typedef qint64 Value;
85 
95  {
96  public:
97  CaptureTable(const QRegExp &exp,
98  const qint8 yearP,
99  const qint8 monthP,
100  const qint8 dayP = -1,
101  const qint8 tDelimiterP = -1,
102  const qint8 hourP = -1,
103  const qint8 minutesP = -1,
104  const qint8 secondsP = -1,
105  const qint8 msecondsP = -1) : regExp(exp),
106  year(yearP),
107  month(monthP),
108  day(dayP),
109  tDelimiter(tDelimiterP),
110  hour(hourP),
111  minutes(minutesP),
112  seconds(secondsP),
113  mseconds(msecondsP)
114  {
115  Q_ASSERT(exp.isValid());
116  Q_ASSERT(yearP == -1 || yearP == 2);
117  }
118 
120  const qint8 year;
121  const qint8 month;
122  const qint8 day;
124  const qint8 hour;
125  const qint8 minutes;
126  const qint8 seconds;
128  };
129 
136  bool operator==(const AbstractDuration &other) const;
137 
138  virtual YearProperty years() const = 0;
139  virtual MonthProperty months() const = 0;
140  virtual DayCountProperty days() const = 0;
141  virtual HourProperty hours() const = 0;
142  virtual MinuteProperty minutes() const = 0;
143  virtual SecondProperty seconds() const = 0;
144  virtual MSecondProperty mseconds() const = 0;
145 
151  virtual Value value() const = 0;
152 
157  virtual Item fromValue(const Value val) const = 0;
158 
167  bool isPositive() const;
168 
169  protected:
170 
171  AbstractDuration(const bool isPos);
172 
174  static AtomicValue::Ptr create(const CaptureTable &captTable,
175  const QString &lexical,
176  bool *isPositive,
184  const bool m_isPositive;
185  };
186 }
187 
189 
191 
192 #endif
qint32 DayCountProperty
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
Base class for classes implementing durations.
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
Due to strong interdependencies, this file contains the definitions for the classes Item...
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
qint8 MinuteProperty
qint32 SecondProperty
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isValid() const
Returns true if the regular expression is valid; otherwise returns false.
Definition: qregexp.cpp:3943
virtual MonthProperty months() const =0
qint8 MonthProperty
signed char qint8
Definition: qglobal.h:933
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual Value value() const =0
virtual DayCountProperty days() const =0
Base class for all classes representing atomic values.
Definition: qitem_p.h:118
The namespace for the internal API of QtXmlPatterns.
virtual HourProperty hours() const =0
__int64 qint64
Definition: qglobal.h:942
virtual YearProperty years() const =0
qint8 HourProperty
qint32 YearProperty
qint64 Value
The amount in milli seconds.
Represents an item in the XPath 2.0 Data Model.
Definition: qitem_p.h:182
bool operator==(const AbstractDuration &other) const
CaptureTable(const QRegExp &exp, const qint8 yearP, const qint8 monthP, const qint8 dayP=-1, const qint8 tDelimiterP=-1, const qint8 hourP=-1, const qint8 minutesP=-1, const qint8 secondsP=-1, const qint8 msecondsP=-1)
static AtomicValue::Ptr create(const CaptureTable &captTable, const QString &lexical, bool *isPositive, YearProperty *years, MonthProperty *months, DayCountProperty *days, HourProperty *hours, MinuteProperty *minutes, SecondProperty *seconds, MSecondProperty *mseconds)
qint16 MSecondProperty
virtual Item fromValue(const Value val) const =0
#define QT_END_HEADER
Definition: qglobal.h:137
Acts as a mapping table for AbstractDuration::create() and describes where certain fields in a QRegEx...
static QString serializeMSeconds(const MSecondProperty mseconds)
QExplicitlySharedDataPointer< AbstractDuration > Ptr