Qt 4.8
Public Functions | List of all members
QPatternist::NumericToAbstractFloatCaster< isDouble > Class Template Reference

Casts a numeric value, such as xs:integer or xs:float, to xs:double or xs:float. More...

#include <qabstractfloatcasters_p.h>

Inheritance diagram for QPatternist::NumericToAbstractFloatCaster< isDouble >:
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

template<const bool isDouble>
class QPatternist::NumericToAbstractFloatCaster< isDouble >

Casts a numeric value, such as xs:integer or xs:float, to xs:double or xs:float.

castFrom() uses Numeric::toDouble() for doing the actual casting.

Author
Vincent Ricard magic.nosp@m.@mag.nosp@m.icnin.nosp@m.ja.o.nosp@m.rg

Definition at line 81 of file qabstractfloatcasters_p.h.

Functions

◆ castFrom()

template<const bool isDouble>
Item QPatternist::NumericToAbstractFloatCaster< isDouble >::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 48 of file qabstractfloatcasters.cpp.

50 {
51  // toDouble() returns same thing than toFloat()
52  return toItem(AbstractFloat<isDouble>::fromValue(from.template as<Numeric>()->toDouble()));
53 }
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
Definition: qitem_p.h:431
static Numeric::Ptr fromValue(const xsDouble num)

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