[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/kdom/patternist/data
From: Frans Englich <frans.englich () telia ! com>
Date: 2006-06-30 16:31:28
Message-ID: 1151685088.339288.11110.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 556547 by englich:
Remove an "optimization". As per the documentation:
* A possible optimization is to create an Integer if the string ends
* with ".0". But this is not conformant. For example, the user writes N.0
* which according to the specification is an xs:decimal, but where the
* expression is, is an xs:integer is required. That would pass with
* such an optimization.
M +4 -16 Decimal.cpp
M +11 -0 Decimal.h
--- trunk/kdenonbeta/kdom/patternist/data/Decimal.cpp #556546:556547
@@ -48,26 +48,14 @@
const xsDecimal num = strNumeric.toDouble(&conversionOk);
if(conversionOk)
- {
- if(Double::isEqual(std::floor(num), num))
- {
- /* The value is for example "3.0". Let's return an xs:integer, which
- * also is a valid xs:decimal. */
- return Integer::fromValue(static_cast<xsInteger>(num));
- }
- else
- return AtomicValue::Ptr(new Decimal(num));
- }
-
- return ValidationError::createError();
+ return AtomicValue::Ptr(new Decimal(num));
+ else
+ return ValidationError::createError();
}
bool Decimal::evaluateEBV(const DynamicContext::Ptr &) const
{
- if(Double::isEqual(m_value, 0.0) || isnan(m_value))
- return false;
- else
- return true;
+ return !Double::isEqual(m_value, 0.0) && !isnan(m_value);
}
QString Decimal::stringValue() const
--- trunk/kdenonbeta/kdom/patternist/data/Decimal.h #556546:556547
@@ -39,6 +39,17 @@
public:
static Decimal::Ptr fromValue(const xsDecimal num);
+
+ /**
+ * Creates a Decimal from the lexical representation of @c xs:decimal stored in
+ * @p strNumeric.
+ *
+ * A possible optimization is to create an Integer if the string ends
+ * with ".0". But this is not conformant. For example, the user writes N.0
+ * which according to the specification is an xs:decimal, but where the
+ * expression is, is an xs:integer is required. That would pass with
+ * such an optimization.
+ */
static AtomicValue::Ptr fromLexical(const QString &strNumeric);
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic