Compile fix for the case when USE_BOOST_FORMAT is 0

* src/support/lstrings.C
	(bformat): Add missing lyx::from_ascii()

	* src/support/convert.C
	(docstring convert<docstring>(unsigned int)): Add specialization
	(docstring convert<docstring>(long)): ditto


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14983 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-09-13 11:18:13 +00:00
parent 179ff08011
commit 61102f1028
2 changed files with 21 additions and 2 deletions

View File

@ -53,12 +53,14 @@ string convert<string>(int i)
return lexical_cast<string>(i); return lexical_cast<string>(i);
} }
template<> template<>
docstring convert<docstring>(int i) docstring convert<docstring>(int i)
{ {
return lyx::from_ascii(lexical_cast<string>(i)); return lyx::from_ascii(lexical_cast<string>(i));
} }
template<> template<>
string convert<string>(unsigned int ui) string convert<string>(unsigned int ui)
{ {
@ -66,6 +68,13 @@ string convert<string>(unsigned int ui)
} }
template<>
docstring convert<docstring>(unsigned int ui)
{
return lyx::from_ascii(lexical_cast<string>(ui));
}
template<> template<>
string convert<string>(unsigned long ul) string convert<string>(unsigned long ul)
{ {
@ -80,6 +89,13 @@ string convert<string>(long l)
} }
template<>
docstring convert<docstring>(long l)
{
return lyx::from_ascii(lexical_cast<string>(l));
}
template<> template<>
string convert<string>(float f) string convert<string>(float f)
{ {

View File

@ -705,6 +705,7 @@ docstring bformat<docstring>(docstring const & fmt, docstring arg1)
} }
template<>
docstring bformat(docstring const & fmt, char * arg1) docstring bformat(docstring const & fmt, char * arg1)
{ {
return (boost::basic_format<char_type>(fmt) % arg1).str(); return (boost::basic_format<char_type>(fmt) % arg1).str();
@ -788,9 +789,11 @@ template<>
docstring bformat(docstring const & fmt, char * arg1) docstring bformat(docstring const & fmt, char * arg1)
{ {
BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s"))); BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s")));
docstring const str = subst(fmt, lyx::from_ascii("%1$s"), arg1); docstring const str = subst(fmt, lyx::from_ascii("%1$s"), lyx::from_ascii(arg1));
return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%")); return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%"));
} }
template<> template<>
docstring bformat(docstring const & fmt, docstring arg1, docstring arg2) docstring bformat(docstring const & fmt, docstring arg1, docstring arg2)
{ {
@ -807,7 +810,7 @@ docstring bformat(docstring const & fmt, char const * arg1, docstring arg2)
{ {
BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s"))); BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s")));
BOOST_ASSERT(contains(fmt, lyx::from_ascii("%2$s"))); BOOST_ASSERT(contains(fmt, lyx::from_ascii("%2$s")));
docstring str = subst(fmt, lyx::from_ascii("%1$s"), arg1); docstring str = subst(fmt, lyx::from_ascii("%1$s"), lyx::from_ascii(arg1));
str = subst(fmt, lyx::from_ascii("%2$s"), arg2); str = subst(fmt, lyx::from_ascii("%2$s"), arg2);
return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%")); return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%"));
} }