Abdelrazak Younes wrote:

> Georg Baum wrote:

> I think you misread something. In my patch, it's either:

I don't think so, see below.

> int i = lex.readInteger();
> 
> or
> lex.next(str);
> int i = lex.toInteger(str);
> 
>> Either you just want to convert str to an integer.
>> Then you should use
>> 
>> int i = convert<int>(str);
> 
> And that's exactly what toInt(str) does. The reason why it is a LyXLex
> member is that it does some checking and call LyXLex::printError() if
> needed:

And that's exactly what I don't like. Passing the buffer to a member
function of lex does just look wrong. Either you do all the processing in
lex as in getInteger(), or if that does not work for some reason then do
everything manually (including calling lex.printError() on failure).

What lex.getInteger() does is immediately clear without even looking at the
docs. For lex.toInteger(str) I have to look up the docs or the
implementation to know why I should use this instead of convert<int>(str).


Georg

Reply via email to