namespace Patterns
{
+ namespace
+ {
+ /**
+ * Read to the end of the stream and
+ * return whether all there is is
+ * whitespace or whether there are other
+ * characters as well.
+ */
+ bool has_only_whitespace (std::istream &in)
+ {
+ while (in)
+ {
+ char c;
+
+ // skip if we've reached the end of
+ // the line
+ if (!(in >> c))
+ break;
+
+ if ((c != ' ') && (c != '\t'))
+ return false;
+ }
+ return true;
+ }
+ }
+
+
+
PatternBase::~PatternBase ()
{}
std::istringstream str(test_string);
int i;
- if (str >> i)
- {
- // check whether valid bounds
- // were specified, and if so
- // enforce their values
- if (lower_bound <= upper_bound)
- return ((lower_bound <= i) &&
- (upper_bound >= i));
- else
- return true;
- };
-
- return false;
+ if (!(str >> i))
+ return false;
+
+ if (!has_only_whitespace (str))
+ return false;
+ // check whether valid bounds
+ // were specified, and if so
+ // enforce their values
+ if (lower_bound <= upper_bound)
+ return ((lower_bound <= i) &&
+ (upper_bound >= i));
+ else
+ return true;
}
std::istringstream str(test_string);
double d;
- if (str >> d)
- {
- // check whether valid bounds
- // were specified, and if so
- // enforce their values
- if (lower_bound <= upper_bound)
- return ((lower_bound <= d) &&
- (upper_bound >= d));
- else
- return true;
- };
- return false;
+ if (!(str >> d))
+ return false;
+
+ if (!has_only_whitespace (str))
+ return false;
+ // check whether valid bounds
+ // were specified, and if so
+ // enforce their values
+ if (lower_bound <= upper_bound)
+ return ((lower_bound <= d) &&
+ (upper_bound >= d));
+ else
+ return true;
}
<ol>
+ <li><p> Fixed: The Patterns::Integer and Patterns::Double classes did
+ not properly check that a value given matched the pattern because they
+ ignored text after an initial match. This led to <code>"3.141"</code> and
+ <code>"3.141..,-RXYZ"</code> to be recognized as valid integers and
+ double values, respectively. This is now fixed.
+ <br>
+ (WB 2010/09/08)
+ </p>
+
<li><p> Fixed: The computation of quadrature points in the QGaussLobatto
class uses a Newton method that was wrongly implemented. While the
results were correct (at least for moderate orders), it required more