forked from boostorg/conversion
Quickbook: Merge from trunk to quickbook-dev.
[SVN r76255]
This commit is contained in:
1 parent
82d366cfb4
commit
5638b5dbec
6 files changed
+236
-20
No files matched your search
@@ -17,8 +17,8 @@
|
||||
// enhanced with contributions from Terje Slettebo,
|
||||
// with additional fixes and suggestions from Gennaro Prota,
|
||||
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann
|
||||
// and other Boosters
|
||||
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
|
||||
// Cheng Yang, Matthew Bradbury and other Boosters
|
||||
// when: November 2000, March 2003, June 2005, June 2006, March 2011
|
||||
|
||||
#include <climits>
|
||||
@@ -586,7 +586,7 @@ namespace boost
|
||||
--end;
|
||||
value = 0;
|
||||
|
||||
if ( *end < czero || *end >= czero + 10 || begin > end)
|
||||
if (begin > end || *end < czero || *end >= czero + 10)
|
||||
return false;
|
||||
value = *end - czero;
|
||||
--end;
|
||||
@@ -684,6 +684,7 @@ namespace boost
|
||||
, const CharT opening_brace, const CharT closing_brace)
|
||||
{
|
||||
using namespace std;
|
||||
if (begin == end) return false;
|
||||
const CharT minus = lcast_char_constants<CharT>::minus;
|
||||
const CharT plus = lcast_char_constants<CharT>::plus;
|
||||
const int inifinity_size = 8;
|
||||
@@ -743,6 +744,26 @@ namespace boost
|
||||
, L'(', L')');
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CHAR16_T
|
||||
template <class T>
|
||||
bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value)
|
||||
{
|
||||
return parse_inf_nan_impl(begin, end, value
|
||||
, u"NAN", u"nan"
|
||||
, u"INFINITY", u"infinity"
|
||||
, u'(', u')');
|
||||
}
|
||||
#endif
|
||||
#ifndef BOOST_NO_CHAR32_T
|
||||
template <class T>
|
||||
bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value)
|
||||
{
|
||||
return parse_inf_nan_impl(begin, end, value
|
||||
, U"NAN", U"nan"
|
||||
, U"INFINITY", U"infinity"
|
||||
, U'(', U')');
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class CharT, class T>
|
||||
bool parse_inf_nan(const CharT* begin, const CharT* end, T& value)
|
||||
@@ -863,7 +884,7 @@ namespace boost
|
||||
CharT const thousands_sep = grouping_size ? np.thousands_sep() : 0;
|
||||
CharT const decimal_point = np.decimal_point();
|
||||
bool found_grouping = false;
|
||||
unsigned int last_grouping_pos = grouping_size - 1;
|
||||
std::string::size_type last_grouping_pos = grouping_size - 1;
|
||||
#else
|
||||
CharT const decimal_point = lcast_char_constants<CharT>::c_decimal_separator;
|
||||
#endif
|
||||
@@ -1183,7 +1204,7 @@ namespace boost
|
||||
bool const result = !(stream << input).fail();
|
||||
start = stringbuffer.pbase();
|
||||
finish = stringbuffer.pptr();
|
||||
return result && (start != finish);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -1354,9 +1375,11 @@ namespace boost
|
||||
|
||||
/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/
|
||||
private:
|
||||
|
||||
template <typename Type>
|
||||
bool shr_unsigned(Type& output)
|
||||
{
|
||||
if (start == finish) return false;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
bool has_minus = false;
|
||||
@@ -1391,6 +1414,7 @@ namespace boost
|
||||
template <typename Type>
|
||||
bool shr_signed(Type& output)
|
||||
{
|
||||
if (start == finish) return false;
|
||||
CharT const minus = lcast_char_constants<CharT>::minus;
|
||||
CharT const plus = lcast_char_constants<CharT>::plus;
|
||||
typedef BOOST_DEDUCED_TYPENAME make_unsigned<Type>::type utype;
|
||||
@@ -1480,7 +1504,7 @@ namespace boost
|
||||
}
|
||||
|
||||
/************************************ OPERATORS >> ( ... ) ********************************/
|
||||
public:
|
||||
public:
|
||||
bool operator>>(unsigned short& output) { return shr_unsigned(output); }
|
||||
bool operator>>(unsigned int& output) { return shr_unsigned(output); }
|
||||
bool operator>>(unsigned long int& output) { return shr_unsigned(output); }
|
||||
@@ -1493,11 +1517,19 @@ namespace boost
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
bool operator>>(unsigned __int64& output) { return shr_unsigned(output); }
|
||||
bool operator>>(__int64& output) { return shr_signed(output); }
|
||||
|
||||
#endif
|
||||
bool operator>>(CharT& output) { return shr_xchar(output); }
|
||||
bool operator>>(char& output) { return shr_xchar(output); }
|
||||
bool operator>>(unsigned char& output) { return shr_xchar(output); }
|
||||
bool operator>>(signed char& output) { return shr_xchar(output); }
|
||||
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
bool operator>>(wchar_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
#ifndef BOOST_NO_CHAR16_T
|
||||
bool operator>>(char16_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
#ifndef BOOST_NO_CHAR32_T
|
||||
bool operator>>(char32_t& output) { return shr_xchar(output); }
|
||||
#endif
|
||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
bool operator>>(std::string& str) { str.assign(start, finish); return true; }
|
||||
# ifndef BOOST_LCAST_NO_WCHAR_T
|
||||
|
||||
Reference in new issue
Block a user