X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftabular.C;h=f07b3e48c28aa6831c3f0feb19cef526996bd1dc;hb=73603ed31be3133738cb93a65dd5ead9782c7a34;hp=9655a5c50899fab606c4de83cc170306991a001d;hpb=742ffb30325d81fe4517ef86aa3f0073a7f68270;p=lyx.git diff --git a/src/tabular.C b/src/tabular.C index 9655a5c508..f07b3e48c2 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -30,14 +30,13 @@ #include "insets/insettabular.h" #include "support/lstrings.h" -#include "support/tostr.h" +#include "support/convert.h" #include using lyx::support::ltrim; using lyx::support::prefixIs; using lyx::support::rtrim; -using lyx::support::strToInt; using lyx::support::suffixIs; using boost::shared_ptr; @@ -70,36 +69,41 @@ string const write_attribute(string const & name, T const & 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, 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, tostr(b)) : string(); + return b ? write_attribute(name, convert(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, tostr(i)) : string(); + return i ? write_attribute(name, convert(i)) : string(); } +template <> string const write_attribute(string const & name, LyXTabular::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, tostr(i)) : string(); + return i ? write_attribute(name, convert(i)) : string(); } +template <> string const write_attribute(string const & name, LyXLength const & value) { // we write only the value if we really have one same reson as above. @@ -244,7 +248,7 @@ bool getTokenValue(string const & str, char const * token, int & num) num = 0; if (!getTokenValue(str, token, tmp)) return false; - num = strToInt(tmp); + num = convert(tmp); return true; }