lyx_mirror/src/insets
Abdelrazak Younes 4d5ae916ad Fix bug 3293 by Bernhard Roider:
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
2007-03-26 13:43:49 +00:00
..
ChangeLog merge booktabs branch 2006-07-03 19:13:56 +00:00
ExternalSupport.C Fix bug 3232 2007-02-28 09:12:32 +00:00
ExternalSupport.h Fix bug 3240 2007-02-15 21:22:40 +00:00
ExternalTemplate.C Next step of true unicode filenames: Use support::FileName instead of 2006-11-26 21:30:39 +00:00
ExternalTemplate.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
ExternalTransforms.C move everything into namespace lyx 2006-10-21 00:16:43 +00:00
ExternalTransforms.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
inset.C move everything into namespace lyx 2006-10-21 00:16:43 +00:00
inset.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
insetbase.C * src/insets/insetbase.[Ch]: make plaintext() abstract to force subclasses to 2007-02-16 10:05:30 +00:00
insetbase.h * inset*.C: 2007-02-20 17:52:41 +00:00
insetbibitem.C * src/insets/insetbititem.C: 2007-02-17 16:36:45 +00:00
insetbibitem.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
insetbibtex.C Fix bug 3067: Special column attributes can contain non-ascii characters, 2007-01-05 17:11:32 +00:00
insetbibtex.h Convert most of the bibtex machinery to docstring. 2006-12-17 10:52:04 +00:00
insetbox.C Fix bug 3293 by Bernhard Roider: 2007-03-26 13:43:49 +00:00
insetbox.h * src/insets/insetbox.[Ch]: 2007-02-15 22:59:06 +00:00
insetbranch.C * inset*.C: 2007-02-20 17:52:41 +00:00
insetbranch.h * src/insets/insetbranch.[Ch]: 2007-02-16 09:28:25 +00:00
insetcaption.C Fix bug 3235 2007-03-18 10:59:16 +00:00
insetcaption.h Add const access to caption type. 2007-03-15 11:47:02 +00:00
insetcharstyle.C * src/insets/insetfloatlist.C: fix plaintex() 2007-02-17 15:28:50 +00:00
insetcharstyle.h * src/insets/insetfloatlist.C: fix plaintex() 2007-02-17 15:28:50 +00:00
insetcite.C * BufferParams: 2007-03-25 01:12:38 +00:00
insetcite.h * BufferParams: 2007-03-25 01:12:38 +00:00
insetcollapsable.C * src/insets/insetcollapsable.[Ch]: constify floatName() 2007-02-16 09:11:19 +00:00
insetcollapsable.h * src/insets/insetcollapsable.[Ch]: constify floatName() 2007-02-16 09:11:19 +00:00
insetcommand.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
insetcommand.h * insetref.C: 2007-02-15 23:28:31 +00:00
insetcommandparams.C New nomenclature inset from Ugras 2006-11-04 17:55:36 +00:00
insetcommandparams.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
insetenv.C * inset*.C: 2007-02-20 17:52:41 +00:00
insetenv.h * src/insets/insetbase.[Ch]: make plaintext() abstract to force subclasses to 2007-02-16 10:05:30 +00:00
insetert.C Fix bug 3293 by Bernhard Roider: 2007-03-26 13:43:49 +00:00
insetert.h * insetert.[Ch]: 2007-02-15 22:27:45 +00:00
insetexternal.C add some comments 2007-03-25 16:45:51 +00:00
insetexternal.h * src/insets/insetexternal.[Ch]: fix plaintext(); code formatting; header alignment 2007-02-18 10:57:23 +00:00
insetfloat.C * inset*.C: 2007-02-20 17:52:41 +00:00
insetfloat.h * src/insets/insetfloat.[Ch]: 2007-02-16 08:15:16 +00:00
insetfloatlist.C fix compiler warning 2007-02-21 21:09:43 +00:00
insetfloatlist.h * src/insets/insetfloatlist.C: fix plaintex() 2007-02-17 15:28:50 +00:00
insetfoot.C Fix bug 3235 2007-03-18 10:59:16 +00:00
insetfoot.h * src/insets/insetbranch.[Ch]: 2007-02-16 09:28:25 +00:00
insetfootlike.C * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
insetfootlike.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
insetgraphics.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
insetgraphics.h * insetgraphics.[Ch]: 2007-02-17 11:30:58 +00:00
insetgraphicsParams.C - fix bug 2458 2007-03-02 22:20:32 +00:00
insetgraphicsParams.h Split FileName into FileName and DocFileName. FileName will be used for all 2006-11-18 12:49:47 +00:00
insethfill.C * src/output_plaintext.C: check line length before outputting 2007-02-15 16:07:36 +00:00
insethfill.h * src/output_plaintext.C: check line length before outputting 2007-02-15 16:07:36 +00:00
insetinclude.C add some comments 2007-03-25 16:45:51 +00:00
insetinclude.h * src/insets/insetinclude.[Ch]: fix plaintext(); code formatting 2007-02-20 19:14:55 +00:00
insetindex.C Fix sgml::escapeChar and sgml::escapeString to return docstring. 2006-10-21 11:38:43 +00:00
insetindex.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
insetlabel.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
insetlabel.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
insetline.C fix compiler warnings about unused parameters 2007-02-24 17:18:13 +00:00
insetline.h * insetert.[Ch]: 2007-02-15 22:27:45 +00:00
insetmarginal.C * inset*.C: 2007-02-20 17:52:41 +00:00
insetmarginal.h * src/insets/insetfloat.[Ch]: 2007-02-16 08:15:16 +00:00
insetnewline.C fix compiler warnings about unused parameters 2007-02-24 17:18:13 +00:00
insetnewline.h * insetert.[Ch]: 2007-02-15 22:27:45 +00:00
insetnomencl.C fix compiler warnings 2006-11-10 21:13:17 +00:00
insetnomencl.h fix docbook glossary export, from Ugras and me 2006-11-10 15:45:42 +00:00
insetnote.C Fix bug 3293 by Bernhard Roider: 2007-03-26 13:43:49 +00:00
insetnote.h * src/insets/insetbox.[Ch]: 2007-02-15 22:59:06 +00:00
insetoptarg.C * src/insets/insetert.C: 2007-02-18 18:55:11 +00:00
insetoptarg.h * src/insets/insetspace.[Ch]: 2007-02-15 23:44:33 +00:00
insetpagebreak.C fix compiler warnings about unused parameters 2007-02-24 17:18:13 +00:00
insetpagebreak.h * insetref.C: 2007-02-15 23:28:31 +00:00
insetquotes.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
insetquotes.h * insets/insetbase.h (textString): Simplify the signature 2007-01-19 16:23:13 +00:00
insetref.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
insetref.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
insetspace.C * src/insets/insetspace.[Ch]: 2007-02-15 23:44:33 +00:00
insetspace.h * src/insets/insetspace.[Ch]: 2007-02-15 23:44:33 +00:00
insetspecialchar.C * src/insets/insettoc.[Ch]: 2007-02-17 11:59:42 +00:00
insetspecialchar.h * src/insets/insettoc.[Ch]: 2007-02-17 11:59:42 +00:00
insettabular.C Fix bug 3293 by Bernhard Roider: 2007-03-26 13:43:49 +00:00
insettabular.h Fix bug 3258: 2007-03-26 13:36:27 +00:00
insettext.C * inset*.C: 2007-02-20 17:52:41 +00:00
insettext.h The caption inset patch by Georg, Martin and myself. 2007-01-30 13:23:21 +00:00
insettheorem.C * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
insettheorem.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
insettoc.C fix compiler warnings about unused parameters 2007-02-24 17:18:13 +00:00
insettoc.h * src/insets/insettoc.[Ch]: 2007-02-17 11:59:42 +00:00
inseturl.C * insets/*.C: constify docstring in plaintext() 2007-02-24 14:35:38 +00:00
inseturl.h * src/insets/insetbranch.[Ch]: 2007-02-16 09:28:25 +00:00
insetvspace.C Fix bug 3293 by Bernhard Roider: 2007-03-26 13:43:49 +00:00
insetvspace.h * src/insets/insetnewline.C: 2007-02-17 11:18:15 +00:00
insetwrap.C * inset*.C: 2007-02-20 17:52:41 +00:00
insetwrap.h * src/insets/insetfloat.[Ch]: 2007-02-16 08:15:16 +00:00
mailinset.C move everything into namespace lyx 2006-10-21 00:16:43 +00:00
mailinset.h move everything into namespace lyx 2006-10-21 00:16:43 +00:00
Makefile.am Convert lyxaccents to unicode (most of the work comes from Georg) 2007-02-11 23:52:07 +00:00
pch.h Use the preferred calling for Boost.Signal 2004-09-26 14:19:47 +00:00
render_base.h Button face-lift: use mouse hover-buttons. 2006-12-04 04:31:18 +00:00
render_button.C Button face-lift: use mouse hover-buttons. 2006-12-04 04:31:18 +00:00
render_button.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
render_graphic.C * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
render_graphic.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
render_preview.C * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00
render_preview.h * dimension.h: new operator!=() and operator=() 2006-11-28 15:15:49 +00:00