Qt 4.8
Public Functions | List of all members
QPatternist::NumericToBooleanCaster Class Reference

Casts any numeric value to xs:boolean. More...

#include <qatomiccasters_p.h>

Inheritance diagram for QPatternist::NumericToBooleanCaster:
QPatternist::AtomicCaster QPatternist::AtomicTypeVisitorResult QSharedData

Public Functions

virtual Item castFrom (const Item &from, const QExplicitlySharedDataPointer< DynamicContext > &context) const
 
- Public Functions inherited from QPatternist::AtomicCaster
 AtomicCaster ()
 
virtual ~AtomicCaster ()
 
- Public Functions inherited from QPatternist::AtomicTypeVisitorResult
 AtomicTypeVisitorResult ()
 
virtual ~AtomicTypeVisitorResult ()
 
- 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...
 

Additional Inherited Members

- Public Types inherited from QPatternist::AtomicCaster
typedef QExplicitlySharedDataPointer< AtomicCasterPtr
 
- Public Types inherited from QPatternist::AtomicTypeVisitorResult
typedef QExplicitlySharedDataPointer< AtomicTypeVisitorResultPtr
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Casts any numeric value to xs:boolean.

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

Definition at line 185 of file qatomiccasters_p.h.

Functions

◆ castFrom()

Item NumericToBooleanCaster::castFrom ( const Item from,
const QExplicitlySharedDataPointer< DynamicContext > &  context 
) const
virtual

Casts from to an atomic value of the type this class casts to, and returns that value. The context is used for reporting errors in case the casting fails, and to in general access information from the dynamic context.

Implements QPatternist::AtomicCaster.

Definition at line 108 of file qatomiccasters.cpp.

110 {
111  const xsDouble val = from.as<Numeric>()->toDouble();
112  if(Double::isEqual(val, 0.0) || qIsNaN(val))
114  else
116 }
static const AtomicValue::Ptr BooleanTrue
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
Definition: qnumeric.cpp:55
static bool isEqual(const xsDouble a, const xsDouble b)
Base class for all numeric values.
static qreal toDouble(const QChar *&str)
TCastTarget * as() const
Definition: qitem_p.h:278
static const AtomicValue::Ptr BooleanFalse

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