Qt 4.8
qabstractfloat_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_AbstractFloat_H
53 #define Patternist_AbstractFloat_H
54 
55 #include <math.h>
56 
57 #include <qnumeric.h>
58 
59 #include "qcommonvalues_p.h"
60 #include "qdecimal_p.h"
61 #include "qschemanumeric_p.h"
62 #include "qvalidationerror_p.h"
63 #include "qbuiltintypes_p.h"
64 
66 
68 
69 namespace QPatternist
70 {
77  template <const bool isDouble>
78  class AbstractFloat : public Numeric
79  {
80  public:
81  static Numeric::Ptr fromValue(const xsDouble num);
82  static AtomicValue::Ptr fromLexical(const QString &strNumeric);
83 
91  static bool isEqual(const xsDouble a, const xsDouble b);
92 
99 
111  virtual QString stringValue() const;
112 
113  virtual xsDouble toDouble() const;
114  virtual xsInteger toInteger() const;
115  virtual xsFloat toFloat() const;
116  virtual xsDecimal toDecimal() const;
117 
118  virtual Numeric::Ptr round() const;
119  virtual Numeric::Ptr roundHalfToEven(const xsInteger scale) const;
120  virtual Numeric::Ptr floor() const;
121  virtual Numeric::Ptr ceiling() const;
122  virtual Numeric::Ptr abs() const;
123 
124  virtual bool isNaN() const;
125  virtual bool isInf() const;
126 
127  virtual ItemType::Ptr type() const;
128  virtual Item toNegated() const;
129  virtual qulonglong toUnsignedInteger() const;
130 
131  virtual bool isSigned() const;
132  protected:
133  AbstractFloat(const xsDouble num);
134 
135  private:
144  static inline int internalSignbit(const xsDouble v);
145  inline bool isZero() const;
146 
148  };
149 
150  template <const bool isDouble>
151  Numeric::Ptr createFloat(const xsDouble num);
152 
153 #include "qabstractfloat.cpp"
154 
161 
168 }
169 
171 
173 
174 #endif
Base template class for Float and Double classes.
virtual xsDecimal toDecimal() const
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
virtual Item toNegated() const
qint64 xsInteger
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
virtual bool isSigned() const
Returns true if this value is signed. If false is returned, the value is unsigned.
long ASN1_INTEGER_get ASN1_INTEGER * a
virtual Numeric::Ptr round() const
virtual xsFloat toFloat() const
The QString class provides a Unicode character string.
Definition: qstring.h:83
AbstractFloat< false > Float
An instantiation of AbstractFloat suitable for xs:float.
xsDouble xsDecimal
virtual Numeric::Ptr roundHalfToEven(const xsInteger scale) const
static int internalSignbit(const xsDouble v)
Numeric::Ptr createFloat(const xsDouble num)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual Numeric::Ptr floor() const
static AtomicValue::Ptr fromLexical(const QString &strNumeric)
virtual bool isInf() const
virtual qulonglong toUnsignedInteger() const
The namespace for the internal API of QtXmlPatterns.
bool evaluateEBV(const QExplicitlySharedDataPointer< DynamicContext > &) const
virtual bool isNaN() const
virtual QString stringValue() const
virtual xsDouble toDouble() const
Represents an item in the XPath 2.0 Data Model.
Definition: qitem_p.h:182
static bool isEqual(const xsDouble a, const xsDouble b)
Base class for all numeric values.
virtual ItemType::Ptr type() const
Contains class Numeric. This file was originally called qnumeric_p.h, but various build systems canno...
virtual xsInteger toInteger() const
static Numeric::Ptr fromValue(const xsDouble num)
virtual Numeric::Ptr ceiling() const
xsDouble xsFloat
AbstractFloat< true > Double
An instantiation of AbsbstractFloat suitable for xs:double.
AbstractFloat(const xsDouble num)
quint64 qulonglong
Definition: qglobal.h:952
#define QT_END_HEADER
Definition: qglobal.h:137
This file is included by qabstractfloat_p.h. If you need includes in this file, put them in qabstract...
virtual Numeric::Ptr abs() const