QString class because of the clumsy error checking mechanism, so I wrote a little wrapper for boost::lexical_cast.
boost::lexical_cast is not written with extensibility in mind so a temporary std::basic_string variable is required to perform the magic (or at least I couldn't find a better, unobtrusive way).
namespace boost { namespace detail {
#ifndef DISABLE_WIDE_CHAR_SUPPORT
inline bool operator>>(boost::detail::lexical_stream<QString, std::wstring>& in, QString& output)
{
std::wstring tmp;
in >> tmp;
output = QString::fromStdWString(tmp);
return true;
}
#endif
template<typename Source>
inline bool operator>>(boost::detail::lexical_stream<QString, Source>& in, QString& output)
{
#if defined(BOOST_NO_STRINGSTREAM)
in << '\0';
#endif
std::string tmp;
in >> tmp;
output = QString::fromStdString(tmp);
return true;
}
}}
This allows you to write something like:
QString x("123");
int id(boost::lexical_cast<int>(x));
|
|
December '07 |
|
||||
| Mo | Tu | We | Th | Fr | Sa | Su |
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 | ||||||
2006-2008 Giuseppe 'Cowo' Corbelli | Cowo's homepage | Cowo's photo page | Contact me | Back to top
Design by Andreas Viklund | Serendipity Template by Carl