2005-01-27 21:05:44 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "../convert.h"
|
2007-02-26 09:31:01 +00:00
|
|
|
#include "../docstring.h"
|
2005-01-27 21:05:44 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2007-02-25 21:17:24 +00:00
|
|
|
using lyx::convert;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2005-01-27 21:05:44 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2007-02-26 09:31:01 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
docstring const _(string const & s) { return from_ascii(s); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-27 21:05:44 +00:00
|
|
|
void convert_int()
|
|
|
|
{
|
|
|
|
cout << convert<int>("123") << '\n'
|
|
|
|
<< convert<int>(" 123") << '\n'
|
|
|
|
<< convert<int>("123 ") << '\n'
|
|
|
|
<< convert<int>(" 123 ") << '\n'
|
|
|
|
|
|
|
|
<< convert<int>("123 123") << '\n'
|
|
|
|
<< convert<int>(" 123 123") << '\n'
|
|
|
|
<< convert<int>("123 123 ") << '\n'
|
|
|
|
<< convert<int>(" 123 123 ") << '\n'
|
|
|
|
|
|
|
|
<< convert<int>("-123") << '\n'
|
|
|
|
<< convert<int>(" -123") << '\n'
|
|
|
|
<< convert<int>("-123 ") << '\n'
|
|
|
|
<< convert<int>(" -123 ") << '\n'
|
|
|
|
|
|
|
|
<< convert<int>("-123 123") << '\n'
|
|
|
|
<< convert<int>(" -123 123") << '\n'
|
|
|
|
<< convert<int>("-123 123 ") << '\n'
|
|
|
|
<< convert<int>(" -123 123 ") << '\n'
|
|
|
|
|
|
|
|
<< convert<int>("") << '\n'
|
|
|
|
<< convert<int>("abc") << '\n'
|
|
|
|
<< convert<int>(" abc") << '\n'
|
|
|
|
<< convert<int>("abc ") << '\n'
|
|
|
|
<< convert<int>(" abc ") << '\n'
|
|
|
|
|
|
|
|
<< convert<int>(" 123 abc") << '\n'
|
|
|
|
<< convert<int>("123 abc ") << '\n'
|
|
|
|
<< convert<int>(" 123 abc ") << '\n'
|
|
|
|
<< convert<int>("123 abc") << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void convert_unsigned()
|
|
|
|
{
|
|
|
|
cout << convert<unsigned int>(string("123")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" 123")) << '\n'
|
|
|
|
<< convert<unsigned int>(string("123 ")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" 123 ")) << '\n'
|
|
|
|
|
|
|
|
<< convert<unsigned int>(string("123 123")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" 123 123")) << '\n'
|
|
|
|
<< convert<unsigned int>(string("123 123 ")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" 123 123 ")) << '\n'
|
|
|
|
|
|
|
|
<< convert<unsigned int>(string()) << '\n'
|
|
|
|
<< convert<unsigned int>(string("abc")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" abc")) << '\n'
|
|
|
|
<< convert<unsigned int>(string("abc ")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" abc ")) << '\n'
|
|
|
|
|
|
|
|
<< convert<unsigned int>(string(" 123 abc")) << '\n'
|
|
|
|
<< convert<unsigned int>(string("123 abc ")) << '\n'
|
|
|
|
<< convert<unsigned int>(string(" 123 abc ")) << '\n'
|
|
|
|
<< convert<unsigned int>(string("123 abc")) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void convert_string()
|
|
|
|
{
|
|
|
|
cout << convert<string>(123) << '\n'
|
|
|
|
<< convert<string>(4294967173u) << '\n'
|
|
|
|
<< convert<string>(true) << '\n'
|
|
|
|
<< convert<string>(false) << '\n'
|
|
|
|
|
|
|
|
<< convert<string>('a') << '\n'
|
|
|
|
<< convert<string>(1.0) << '\n'
|
|
|
|
<< convert<string>(1.1) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
convert_int();
|
|
|
|
convert_unsigned();
|
|
|
|
convert_string();
|
|
|
|
}
|