This changes the semantics of isOK() and operator(), comments from Bernhard below:
With the old version of lyxlex it was _impossible_ to check whether reading an integer, float, ... succeeded or not. The current solution to check for is.bad() in some cases and in other cases use is.good() does not give the desired information. Moreover the result of is.bad() depends on the stl implementation and behaves different for linux and windows.
the bug was introduced by the patch that fixed the bug that crashed lyx when "inset-insert ert" was executed from the command buffer.
The lexer has the method isOK() which reflects the status of the stream is.
The operators void* and ! are not really well defined (they depend on the value of is.bad()). What is missing is a test if the last reading operation was successful and thus the returned value is valid.
That's what i implemented in this patch.
The new rule for using the lexer:
if you want to know if the lexer still has data to read (either from the stream or from the pushed token) then use "lex.isOK()".
If you want to test if the last reading operation was successful then use eg. "if (lex) {...}" or unsuccessful then use eg. "if (!lex) {...}"
an example:
int readParam(LyxLex &lex) {
int param = 1; // default value
if (lex.isOK()) { // the lexer has data to read
int p; // temporary variable
lex >> p;
if (lex) param = p; // only use the input if the reading operation was successful
}
return param;
}
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17569 a592a061-630c-0410-9148-cb99ea01b6c8
support.
LyXRC::font_norm stays for now, since it is still used for the kbmap stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17566 a592a061-630c-0410-9148-cb99ea01b6c8
* src/mathed/MathData.C
(MathArray::metrics): Explicitly initialize kerning_ as it may
contain random data when the nucleus is an empty MathFont inset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17560 a592a061-630c-0410-9148-cb99ea01b6c8
- add flags for debug/release/profile
- also build qt4 as one file with gcc
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17558 a592a061-630c-0410-9148-cb99ea01b6c8
* src/buffer.C
(Buffer::makeLaTeXFile): Use runparams.encoding to be consistent
* src/insets/insetinclude.C
(InsetInclude::latex): Change runparams.encoding to the encoding of
the child document for makeLateXFile
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17555 a592a061-630c-0410-9148-cb99ea01b6c8
TODO: extract the latexHighlighter class into its own .[Ch] files.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17553 a592a061-630c-0410-9148-cb99ea01b6c8
(RowPainter::paintHebrewComposeChar): Convert characters 0xf8 and
0xe3 from CP1255 to UCS4 encoding
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17547 a592a061-630c-0410-9148-cb99ea01b6c8
Those arguments are not needed because update() will always look at what is currently selected and the info is there.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17546 a592a061-630c-0410-9148-cb99ea01b6c8
- now simple citation insertion can be done with the keyboard only (enter key will close the dialog and insert the chosen key).
- now search also within bib entry information (very fast)
- new case sensitive option
- new regex option.
- QCitation: code simplified, some code went to ControlCitation.
- QCitationDialog: code simplified
- lots of polish in the dialogs...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17539 a592a061-630c-0410-9148-cb99ea01b6c8
* DockView.h: add the orientation option.
* QViewSource: now a model and a controller
* QViewSourceDialog: now only a simple QWidget.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17538 a592a061-630c-0410-9148-cb99ea01b6c8
* transfer CiteEngine enum declaration to biblio.h
* delete unneeded CiteEngine_enum
* cite_engine is now cite_engine_ and is private.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17537 a592a061-630c-0410-9148-cb99ea01b6c8
- replace unneeded dynamic_cast with static_cast
- fix citation info for normal BIBITEM entries.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17535 a592a061-630c-0410-9148-cb99ea01b6c8
* src/encoding.C
(arabic_table): Delete (this was used for fonts in iso8859-6 encoding)
(arabic_table2): Rename to arabic_table and update code points to UCS4.
The old code points in this table where a custom encoding:
Some ASCII positions and some unused positions of the iso8859-6
encoding where used to encode the shaped forms. Example:
The character hamza was encoded with 0x41. The iso8859-6 encoding in
lib/encodings contained ithe value 0xfe80 at position 0x41 before
the transition to unicode => Change the value 0x41 to 0xfe80 in the
table.
This old custom encoding was needed because the transformed characters
needed to be transported through 8bit characters.
(Encodings::is_arabic_special): Change code points from iso8859-6 to UCS4
(Encodings::isComposeChar_arabic): Ditto
(Encodings::is_arabic): Ditto
(Encodings::transformChar): Always use arabic_table
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17532 a592a061-630c-0410-9148-cb99ea01b6c8
* src/frontends/controllers/ControlCharacter.[Ch]
(reset_lang_) New flag (needed because the language is never
inherited)
* src/frontends/controllers/ControlCharacter.C
(ControlCharacter::getLanguage): Use reset_lang_
(ControlCharacter::setLanguage): Set reset_lang_ if needed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17526 a592a061-630c-0410-9148-cb99ea01b6c8