mirror of
https://github.com/boostorg/conversion.git
synced 2025-08-03 22:44:32 +02:00
bcbboost branch rebased on current release
[SVN r49389]
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
#if defined(BOOST_NO_STRINGSTREAM) || \
|
#if defined(BOOST_NO_STRINGSTREAM) || \
|
||||||
defined(BOOST_NO_STD_WSTRING) || \
|
defined(BOOST_NO_STD_WSTRING) || \
|
||||||
defined(BOOST_NO_STD_LOCALE)
|
defined(BOOST_NO_STD_LOCALE)
|
||||||
#define DISABLE_WIDE_CHAR_SUPPORT
|
#define BOOST_LCAST_NO_WCHAR_T
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -106,7 +106,7 @@ namespace boost
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct stream_char<wchar_t>
|
struct stream_char<wchar_t>
|
||||||
@@ -231,7 +231,7 @@ namespace boost
|
|||||||
// lcast_src_length<char, signed char const*>
|
// lcast_src_length<char, signed char const*>
|
||||||
// lcast_src_length<char, unsigned char const*>
|
// lcast_src_length<char, unsigned char const*>
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_src_length<wchar_t, bool>
|
struct lcast_src_length<wchar_t, bool>
|
||||||
{
|
{
|
||||||
@@ -270,7 +270,7 @@ namespace boost
|
|||||||
static void check_coverage() {}
|
static void check_coverage() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_src_length<wchar_t, wchar_t const*>
|
struct lcast_src_length<wchar_t, wchar_t const*>
|
||||||
{
|
{
|
||||||
@@ -301,7 +301,7 @@ namespace boost
|
|||||||
static void check_coverage() {}
|
static void check_coverage() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_src_length< wchar_t, std::basic_string<wchar_t> >
|
struct lcast_src_length< wchar_t, std::basic_string<wchar_t> >
|
||||||
{
|
{
|
||||||
@@ -339,34 +339,35 @@ namespace boost
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BOOST_AUX_LEXICAL_CAST_DEF1(CharT, T) template<> \
|
#define BOOST_LCAST_DEF1(CharT, T) \
|
||||||
struct lcast_src_length<CharT, T> : lcast_src_length_integral<T> \
|
template<> struct lcast_src_length<CharT, T> \
|
||||||
|
: lcast_src_length_integral<T> \
|
||||||
{ static void check_coverage() {} };
|
{ static void check_coverage() {} };
|
||||||
|
|
||||||
#ifdef DISABLE_WIDE_CHAR_SUPPORT
|
#ifdef BOOST_LCAST_NO_WCHAR_T
|
||||||
#define BOOST_AUX_LEXICAL_CAST_DEF(T) BOOST_AUX_LEXICAL_CAST_DEF1(char, T)
|
#define BOOST_LCAST_DEF(T) BOOST_LCAST_DEF1(char, T)
|
||||||
#else
|
#else
|
||||||
#define BOOST_AUX_LEXICAL_CAST_DEF(T) \
|
#define BOOST_LCAST_DEF(T) \
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF1(char, T) \
|
BOOST_LCAST_DEF1(char, T) \
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF1(wchar_t, T)
|
BOOST_LCAST_DEF1(wchar_t, T)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(short)
|
BOOST_LCAST_DEF(short)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(unsigned short)
|
BOOST_LCAST_DEF(unsigned short)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(int)
|
BOOST_LCAST_DEF(int)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(unsigned int)
|
BOOST_LCAST_DEF(unsigned int)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(long)
|
BOOST_LCAST_DEF(long)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(unsigned long)
|
BOOST_LCAST_DEF(unsigned long)
|
||||||
#if defined(BOOST_HAS_LONG_LONG)
|
#if defined(BOOST_HAS_LONG_LONG)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(boost::ulong_long_type)
|
BOOST_LCAST_DEF(boost::ulong_long_type)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(boost::long_long_type )
|
BOOST_LCAST_DEF(boost::long_long_type )
|
||||||
#elif defined(BOOST_HAS_MS_INT64)
|
#elif defined(BOOST_HAS_MS_INT64)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF(unsigned __int64)
|
BOOST_LCAST_DEF(unsigned __int64)
|
||||||
BOOST_AUX_LEXICAL_CAST_DEF( __int64)
|
BOOST_LCAST_DEF( __int64)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef BOOST_AUX_LEXICAL_CAST_DEF
|
#undef BOOST_LCAST_DEF
|
||||||
#undef BOOST_AUX_LEXICAL_CAST_DEF1
|
#undef BOOST_LCAST_DEF1
|
||||||
|
|
||||||
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||||
// Helper for floating point types.
|
// Helper for floating point types.
|
||||||
@@ -412,7 +413,7 @@ namespace boost
|
|||||||
static void check_coverage() {}
|
static void check_coverage() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_src_length<wchar_t,float>
|
struct lcast_src_length<wchar_t,float>
|
||||||
: lcast_src_length_floating<float>
|
: lcast_src_length_floating<float>
|
||||||
@@ -434,7 +435,7 @@ namespace boost
|
|||||||
static void check_coverage() {}
|
static void check_coverage() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#endif // #ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
#endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +450,7 @@ namespace boost
|
|||||||
BOOST_STATIC_CONSTANT(char, minus = '-');
|
BOOST_STATIC_CONSTANT(char, minus = '-');
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_char_constants<wchar_t>
|
struct lcast_char_constants<wchar_t>
|
||||||
{
|
{
|
||||||
@@ -608,7 +609,7 @@ namespace boost
|
|||||||
stream.str().swap(output);
|
stream.str().swap(output);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
bool operator>>(std::wstring &output)
|
bool operator>>(std::wstring &output)
|
||||||
{
|
{
|
||||||
stream.str().swap(output);
|
stream.str().swap(output);
|
||||||
@@ -664,7 +665,7 @@ namespace boost
|
|||||||
Traits::assign(*p, ch);
|
Traits::assign(*p, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
static void widen_and_assign(wchar_t* p, char ch)
|
static void widen_and_assign(wchar_t* p, char ch)
|
||||||
{
|
{
|
||||||
// TODO: use BOOST_NO_STD_LOCALE
|
// TODO: use BOOST_NO_STD_LOCALE
|
||||||
@@ -698,9 +699,9 @@ namespace boost
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
lexical_stream_limited_src(CharT* start, CharT* finish)
|
lexical_stream_limited_src(CharT* sta, CharT* fin)
|
||||||
: start(start)
|
: start(sta)
|
||||||
, finish(finish)
|
, finish(fin)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public: // output
|
public: // output
|
||||||
@@ -715,7 +716,7 @@ namespace boost
|
|||||||
|
|
||||||
bool operator<<(bool);
|
bool operator<<(bool);
|
||||||
bool operator<<(char);
|
bool operator<<(char);
|
||||||
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||||
bool operator<<(wchar_t);
|
bool operator<<(wchar_t);
|
||||||
#endif
|
#endif
|
||||||
bool operator<<(CharT const*);
|
bool operator<<(CharT const*);
|
||||||
@@ -780,7 +781,7 @@ namespace boost
|
|||||||
|
|
||||||
bool operator>>(std::string&);
|
bool operator>>(std::string&);
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
bool operator>>(std::wstring&);
|
bool operator>>(std::wstring&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -815,7 +816,7 @@ namespace boost
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||||
template<typename CharT, class Base, class Traits>
|
template<typename CharT, class Base, class Traits>
|
||||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<(
|
||||||
wchar_t ch)
|
wchar_t ch)
|
||||||
@@ -989,7 +990,7 @@ namespace boost
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<typename CharT, class Base, class Traits>
|
template<typename CharT, class Base, class Traits>
|
||||||
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>(
|
||||||
std::wstring& str)
|
std::wstring& str)
|
||||||
@@ -1044,7 +1045,7 @@ namespace boost
|
|||||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(DISABLE_WIDE_CHAR_SUPPORT) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||||
template<>
|
template<>
|
||||||
struct lcast_streambuf_for_target<wchar_t>
|
struct lcast_streambuf_for_target<wchar_t>
|
||||||
{
|
{
|
||||||
@@ -1060,7 +1061,7 @@ namespace boost
|
|||||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<class Traits, class Alloc>
|
template<class Traits, class Alloc>
|
||||||
struct lcast_streambuf_for_target<
|
struct lcast_streambuf_for_target<
|
||||||
std::basic_string<wchar_t,Traits,Alloc> >
|
std::basic_string<wchar_t,Traits,Alloc> >
|
||||||
@@ -1075,7 +1076,7 @@ namespace boost
|
|||||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDE_CHAR_SUPPORT
|
#ifndef BOOST_LCAST_NO_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
struct lcast_streambuf_for_target<std::wstring>
|
struct lcast_streambuf_for_target<std::wstring>
|
||||||
{
|
{
|
||||||
@@ -1196,5 +1197,5 @@ namespace boost
|
|||||||
// accompanying file LICENSE_1_0.txt or copy at
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#undef DISABLE_WIDE_CHAR_SUPPORT
|
#undef BOOST_LCAST_NO_WCHAR_T
|
||||||
#endif
|
#endif
|
||||||
|
@@ -194,18 +194,7 @@ public:
|
|||||||
</pre>
|
</pre>
|
||||||
</blockquote>Exception used to indicate runtime <a href="#lexical_cast"><code>lexical_cast</code></a>
|
</blockquote>Exception used to indicate runtime <a href="#lexical_cast"><code>lexical_cast</code></a>
|
||||||
failure.
|
failure.
|
||||||
|
<hr>
|
||||||
<hr>
|
|
||||||
<h2><a name="BOOST_LEXICAL_CAST_ASSUME_C_LOCALE"><code>BOOST_LEXICAL_CAST_ASSUME_C_LOCALE</code></a></h2>
|
|
||||||
<blockquote><pre>#define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
|
|
||||||
|
|
||||||
or,
|
|
||||||
|
|
||||||
g++ -DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE ... (gcc on Linux/Unix)
|
|
||||||
cl.exe /DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE ... (Visual C++ on Windows)
|
|
||||||
</pre>
|
|
||||||
Eliminate an overhead of <code>std::locale</code> if your program runs in the "C" locale. If the option is set but a program runs in other locale, <code>lexical_cast</code> result is unspecified.
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<h2><a name="faq">Frequently Asked Questions</h2>
|
<h2><a name="faq">Frequently Asked Questions</h2>
|
||||||
<p> Q: Why does <code>lexical_cast<int8_t>("127")</code> throw <code>bad_lexical_cast</code>?
|
<p> Q: Why does <code>lexical_cast<int8_t>("127")</code> throw <code>bad_lexical_cast</code>?
|
||||||
@@ -230,7 +219,7 @@ Eliminate an overhead of <code>std::locale</code> if your program runs in the "C
|
|||||||
<a name="n1973"></a><li> [N1973] Kevlin Henney, Beman Dawes, Lexical Conversion Library Proposal for TR2,
|
<a name="n1973"></a><li> [N1973] Kevlin Henney, Beman Dawes, Lexical Conversion Library Proposal for TR2,
|
||||||
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1973.html">N1973</a>.
|
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1973.html">N1973</a>.
|
||||||
<a name="tuning"></a><li> [Tuning] Alexander Nasonov, Fine Tuning for lexical_cast,
|
<a name="tuning"></a><li> [Tuning] Alexander Nasonov, Fine Tuning for lexical_cast,
|
||||||
<a href="http://accu.org/index.php/journals/1375">Overload #74</a> (<a href="http://www.accu.org/var/uploads/journals/overload74.pdf">PDF</a>),
|
<a href="http://www.accu.org/var/uploads/journals/overload74.pdf">Overload #74</a>,
|
||||||
August 2006.</li>
|
August 2006.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2><a name="changes">Changes</a></h2>
|
<h2><a name="changes">Changes</a></h2>
|
||||||
|
Reference in New Issue
Block a user