Provide do_put methods for inserting "unsigned long" and "double" values

into wide streams on systems where sizeof(wchar_t) == 2.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16272 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2006-12-14 00:31:18 +00:00
parent b89f97f0b4
commit fb5b1bc6c8

View File

@ -457,6 +457,44 @@ protected:
return oit; return oit;
} }
iter_type
do_put(iter_type oit, std::ios_base & b, char_type fill, unsigned long v) const
{
if (fill >= 0x80)
throw num_put_failure();
std::string s;
// 64 is large enough
s.resize(64);
string_num_put_facet f;
std::string::const_iterator cit = s.begin();
std::string::const_iterator end =
f.put(s.begin(), b, fill, v);
for (; cit != end; ++cit, ++oit)
*oit = *cit;
return oit;
}
iter_type
do_put(iter_type oit, std::ios_base & b, char_type fill, double v) const
{
if (fill >= 0x80)
throw num_put_failure();
std::string s;
// 64 is large enough
s.resize(64);
string_num_put_facet f;
std::string::const_iterator cit = s.begin();
std::string::const_iterator end =
f.put(s.begin(), b, fill, v);
for (; cit != end; ++cit, ++oit)
*oit = *cit;
return oit;
}
}; };