We have this in tabular_funcs.h: > template<class T> > string const write_attribute(string const & name, T const & t) > { > string str = " " + name + "=\"" + tostr(t) + "\""; > return str; > } > template<> > string const write_attribute(string const & name, bool const & b); > template<> > string const write_attribute(string const & name, LyXLength const & value);
Now I would assume that write_attribure(string, bool) would call the second function, but it seems this is not true :(. I debugged this with gdb and ONLY the first one (the template one) is called. Why I looked at this code. Well I did it to fix the problem with the file format bloat requested by some people and to write out only "true" values and ignore "false" values. I could do this also be having a if (bool) write_attribute() but this seems pretty stupid to me as it can be solved inside the write_attribute function. So could somebody help me out here. I'll attach the diff so you can see what I did and comment on it. Jug -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen Vigna E-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Got Mole problems? Call Avogadro at 6.02 x 10^23.
? src/frontends/libcontrollers.objects ? src/frontends/libcontrollers.objects.new ? src/frontends/libxforms.objects ? src/frontends/libxforms.objects.new Index: src/tabular_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tabular_funcs.C,v retrieving revision 1.5 diff -u -p -r1.5 tabular_funcs.C --- src/tabular_funcs.C 2002/02/16 15:59:43 1.5 +++ src/tabular_funcs.C 2002/02/20 15:37:28 @@ -30,12 +30,21 @@ using std::getline; 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. + if (!b) + return string(); + return write_attribute(name, int(b)); } 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. + if (value.zero()) + return string(); + return write_attribute(name, value.asString()); } @@ -210,6 +219,9 @@ bool getTokenValue(string const & str, c bool getTokenValue(string const & str, const char * token, bool & flag) { + // set the flag always to false as this should be the default for bools + // not in the file-format. + flag = false; string tmp; if (!getTokenValue(str, token, tmp)) return false; @@ -219,6 +231,9 @@ bool getTokenValue(string const & str, c bool getTokenValue(string const & str, const char * token, LyXLength & len) { + // set the lenght to be zero() as default as this it should be if not + // in the file format. + len = LyXLength(); string tmp; if (!getTokenValue(str, token, tmp)) return false;