Fixup for bug removal in GCC 4.7

A long standing bug has been fixed in GCC 4.7, the bug was a non-
sactioned extra lookup. This caused some code to work that really
shouldn't.

The fixes are: add this->, Class::, or move functions about
as required to fullfill the rules.

In this case some template instantiations
where move to after what they reference.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39813 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2011-10-07 03:09:55 +00:00
parent da087e6fc1
commit 4e3239dc98

View File

@ -188,62 +188,6 @@ TabularFeature tabularFeature[] =
};
template <class T>
string const write_attribute(string const & name, T const & t)
{
string const s = tostr(t);
return s.empty() ? s : " " + name + "=\"" + s + "\"";
}
template <>
string const write_attribute(string const & name, string const & t)
{
return t.empty() ? t : " " + name + "=\"" + t + "\"";
}
template <>
string const write_attribute(string const & name, docstring const & t)
{
return t.empty() ? string() : " " + name + "=\"" + to_utf8(t) + "\"";
}
template <>
string const write_attribute(string const & name, bool const & b)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return b ? write_attribute(name, convert<string>(b)) : string();
}
template <>
string const write_attribute(string const & name, int const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return i ? write_attribute(name, convert<string>(i)) : string();
}
template <>
string const write_attribute(string const & name, Tabular::idx_type const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return i ? write_attribute(name, convert<string>(i)) : string();
}
template <>
string const write_attribute(string const & name, Length const & value)
{
// we write only the value if we really have one same reson as above.
return value.zero() ? string() : write_attribute(name, value.asString());
}
string const tostr(LyXAlignment const & num)
{
switch (num) {
@ -503,6 +447,61 @@ void l_getline(istream & is, string & str)
}
}
template <class T>
string const write_attribute(string const & name, T const & t)
{
string const s = tostr(t);
return s.empty() ? s : " " + name + "=\"" + s + "\"";
}
template <>
string const write_attribute(string const & name, string const & t)
{
return t.empty() ? t : " " + name + "=\"" + t + "\"";
}
template <>
string const write_attribute(string const & name, docstring const & t)
{
return t.empty() ? string() : " " + name + "=\"" + to_utf8(t) + "\"";
}
template <>
string const write_attribute(string const & name, bool const & b)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return b ? write_attribute(name, convert<string>(b)) : string();
}
template <>
string const write_attribute(string const & name, int const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return i ? write_attribute(name, convert<string>(i)) : string();
}
template <>
string const write_attribute(string const & name, Tabular::idx_type const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
return i ? write_attribute(name, convert<string>(i)) : string();
}
template <>
string const write_attribute(string const & name, Length const & value)
{
// we write only the value if we really have one same reson as above.
return value.zero() ? string() : write_attribute(name, value.asString());
}
} // namespace