Georg Baum wrote:
Abdelrazak Younes wrote:

Georg Baum wrote:

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

I don't think so, see below.

You are a complicated guy Georg. I was answering to your false assumption so, in this regard, you misread the patch. I cannot read your mind and understand what you don't like.


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).

You must have misread this line in my previous mail:

It I continue the cleanup I would also get rid of that method.

Abdel.

Reply via email to