Commit Graph

59 Commits

Author SHA1 Message Date
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
Georg Baum
8e6e970d7b Next step of true unicode filenames: Use support::FileName instead of
std::string at many places (not all yet).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16069 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-26 21:30:39 +00:00
Georg Baum
49070b4c00 Fix problem with non-ascii branch names by converting more stuff to
docstring.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15713 a592a061-630c-0410-9148-cb99ea01b6c8
2006-11-03 15:16:45 +00:00
André Pönitz
6c300f72a2 move everything into namespace lyx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15422 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-21 00:16:43 +00:00
Lars Gullik Bjønnes
c46b7d8955 Merge the unicode branch into trunk.
- src/support/unicode.[Ch]: new files with functions for converting
  to and fro ucs4, ucs2 and utf8.
- src/support/docstring.h: specialization of basic_string that
  holds a uint32_t internally.
- Several functions changed to use char_type instead of char or unsigned char.
- Qt3 and Qt4 sends ucs2 on to core
- Gtk sends ucs4 on to core
- Read and write utf-8 .lyx files.
- font_metrics and painter updated to handle ucs4 chars as input.
- Quite a bit of ugly compability code, conversion string->docstring, etc.
- Have fun...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14661 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-13 22:54:59 +00:00
Georg Baum
11d4a7aaed Move quoteArg to LyXLex so that it can be used e.g. for writing viewers to
preferences
        * src/lyxfunc.C
        (quoteArg): move to LyXLex
        (LyXFunc::dispatch): adjust to the change above

        * src/lyxlex.[Ch]
        (quoteString): new, moved from lyxfunc.C


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14620 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-12 10:39:12 +00:00
Lars Gullik Bjønnes
342cdf4322 the convert patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9538 a592a061-630c-0410-9148-cb99ea01b6c8
2005-01-27 21:05:44 +00:00
José Matox
61ba4014ef Remove findToken from lyxlyex, first step to its complete removal.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8960 a592a061-630c-0410-9148-cb99ea01b6c8
2004-08-20 13:06:33 +00:00
José Matox
adec8fe46d Change \papersize Default|Custom to lower letter for consistency.
Fix comment.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8948 a592a061-630c-0410-9148-cb99ea01b6c8
2004-08-15 21:52:13 +00:00
Jürgen Spitzmüller
1cd14974e1 fix off-by-one-error with paperpackage selection
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8824 a592a061-630c-0410-9148-cb99ea01b6c8
2004-06-27 13:14:08 +00:00
Lars Gullik Bjønnes
68b7ef25fb simple ws changes only
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8594 a592a061-630c-0410-9148-cb99ea01b6c8
2004-04-03 08:37:12 +00:00
Angus Leeming
51fa9803d3 Ensure that InsetVSpace works with the new, simpler lyxlex syntax.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8182 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-02 12:27:07 +00:00
André Pönitz
a5e85854f8 * lyxlex.[Ch]: make interface more similar to std::stream
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8179 a592a061-630c-0410-9148-cb99ea01b6c8
2003-12-02 10:19:51 +00:00
Lars Gullik Bjønnes
44cd0fc9a1 The std::string mammoth path.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7862 a592a061-630c-0410-9148-cb99ea01b6c8
2003-10-06 15:43:21 +00:00
Angus Leeming
57a24ea912 Replace 'using namespace abc;' with 'using abc::xyz;'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7725 a592a061-630c-0410-9148-cb99ea01b6c8
2003-09-09 22:13:45 +00:00
Angus Leeming
91de22ef34 Strip 320 #includes from the files in src.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7684 a592a061-630c-0410-9148-cb99ea01b6c8
2003-09-05 16:31:30 +00:00
Angus Leeming
0be0fcfd59 If I ever see another licence blurb again, it'll be too soon...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7598 a592a061-630c-0410-9148-cb99ea01b6c8
2003-08-23 00:17:00 +00:00
Lars Gullik Bjønnes
92d522b7f1 introduce namespace lyx::support
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7224 a592a061-630c-0410-9148-cb99ea01b6c8
2003-06-30 23:56:22 +00:00
Lars Gullik Bjønnes
e25012ddfa lyxlex-2-a.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6795 a592a061-630c-0410-9148-cb99ea01b6c8
2003-04-14 13:12:40 +00:00
Lars Gullik Bjønnes
7b41119463 lyxlex-1-a with some modifications
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6794 a592a061-630c-0410-9148-cb99ea01b6c8
2003-04-14 12:44:36 +00:00
John Levon
868f59f137 split out header parsing
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6454 a592a061-630c-0410-9148-cb99ea01b6c8
2003-03-12 02:39:12 +00:00
André Pönitz
c6c5eb530c simple argument parsing for FuncRequest;
other small stuff


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6288 a592a061-630c-0410-9148-cb99ea01b6c8
2003-02-26 18:03:48 +00:00
Lars Gullik Bjønnes
99d1627a47 dont use pragma impementation and interface anymore
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6138 a592a061-630c-0410-9148-cb99ea01b6c8
2003-02-13 16:53:15 +00:00
Lars Gullik Bjønnes
13349032cb ws changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5758 a592a061-630c-0410-9148-cb99ea01b6c8
2002-12-01 22:59:25 +00:00
John Levon
7c98b3bd37 spellchecker cleanup - fscked knows why pspell is broken, I am TOTALLY
baffled by that one.

Various other cleanups, including a fixed version of lyxlex that doesn't
destroy the preamble ...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4854 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-04 23:11:50 +00:00
Angus Leeming
1c9df5074e Revert John's change as it breaks reading of the user preamble.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4845 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-02 16:18:15 +00:00
John Levon
3f1a78fbeb small cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4841 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-02 13:43:43 +00:00
Lars Gullik Bjønnes
043298544c Rename strip to rtrim
Rename frontStrip to ltrim
Add new trim function.

modify source for this change.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4801 a592a061-630c-0410-9148-cb99ea01b6c8
2002-07-28 22:50:13 +00:00
Jean-Marc Lasgouttes
57e89ae2bf compile fix in XPM image loader; fix opaque handling; remove warnings; fix turkish locale problems; add shortcuts to documents menu
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4661 a592a061-630c-0410-9148-cb99ea01b6c8
2002-07-16 21:17:10 +00:00
John Levon
50a25e9a76 srcdoc fixes + a little tidy or two
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4288 a592a061-630c-0410-9148-cb99ea01b6c8
2002-05-30 03:37:24 +00:00
Lars Gullik Bjønnes
8283e978f8 ws cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3803 a592a061-630c-0410-9148-cb99ea01b6c8
2002-03-21 17:27:08 +00:00
Lars Gullik Bjønnes
7ea7dabed1 to much stuff for my liking...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3554 a592a061-630c-0410-9148-cb99ea01b6c8
2002-02-16 15:59:55 +00:00
Lars Gullik Bjønnes
985aec9f0f apply lyx.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3158 a592a061-630c-0410-9148-cb99ea01b6c8
2001-12-05 23:04:07 +00:00
Lars Gullik Bjønnes
33a28bdc9c Add string << operators for the other streams as well, and removes
c_str() all places where it is not needed anymore.
(I also add config.h to several files that was missing it)
+ added s string constructor to math_symbolinset

I also change some "while(" to "while ("

mmm ... yes ... I add a "zero()" function to LyXLength... an "empty()"
function did not seem appropriate. changed a couple of places that
checked on length.value() != 0.0.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3149 a592a061-630c-0410-9148-cb99ea01b6c8
2001-12-05 08:04:20 +00:00
Lars Gullik Bjønnes
a0bf0835e5 more funcs to lowerchar, adjust
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2428 a592a061-630c-0410-9148-cb99ea01b6c8
2001-08-06 19:12:46 +00:00
Asger Ottar Alstrup
da76673568 Reduced header file includes somewhat
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2385 a592a061-630c-0410-9148-cb99ea01b6c8
2001-07-29 15:34:18 +00:00
Lars Gullik Bjønnes
83acbbd523 update copyright year
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2072 a592a061-630c-0410-9148-cb99ea01b6c8
2001-05-30 13:53:44 +00:00
Jean-Marc Lasgouttes
1a3ed565d9 Use lyxlex to parse rgb.txt + small compilation fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1206 a592a061-630c-0410-9148-cb99ea01b6c8
2000-11-08 15:19:55 +00:00
Lars Gullik Bjønnes
d6665cba42 get rid of dead code, some new functions constify variables.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1041 a592a061-630c-0410-9148-cb99ea01b6c8
2000-09-26 13:54:57 +00:00
Jean-Marc Lasgouttes
567e0d583f Various small fixes. Read Changelog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1040 a592a061-630c-0410-9148-cb99ea01b6c8
2000-09-26 13:10:34 +00:00
Lars Gullik Bjønnes
45a03f4f67 use the new sstream return non-pods as const, use string instead of char * in a lot of places
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1019 a592a061-630c-0410-9148-cb99ea01b6c8
2000-09-14 17:53:12 +00:00
Lars Gullik Bjønnes
eeaae9c355 more changes read the ChangeLog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@954 a592a061-630c-0410-9148-cb99ea01b6c8
2000-08-05 05:17:18 +00:00
Jean-Marc Lasgouttes
4b2a999762 GUI-indep toolbar and menus mostly work !
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@913 a592a061-630c-0410-9148-cb99ea01b6c8
2000-07-24 13:53:19 +00:00
Lars Gullik Bjønnes
e5f1824f33 trying to track down a bug in lyxlex with gcc 2.96, new insetmarginal, mini fix to insetfoot and testing the new lyx-cvs mailing list
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@838 a592a061-630c-0410-9148-cb99ea01b6c8
2000-06-26 18:34:31 +00:00
Lars Gullik Bjønnes
6bba977f42 FILMagain changes (will need some work)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@807 a592a061-630c-0410-9148-cb99ea01b6c8
2000-06-12 11:27:15 +00:00
Jürgen Vigna
fa6aa115e7 Various warnings fixed, added preliminary read of old table format and
fixed a bug when removing error-insets with AutoDeleteInsets().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@736 a592a061-630c-0410-9148-cb99ea01b6c8
2000-05-17 14:43:09 +00:00
Lars Gullik Bjønnes
76938908d7 use more explicit on constructors use the pimpl idom to reduce size with about 500k
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@641 a592a061-630c-0410-9148-cb99ea01b6c8
2000-04-08 17:02:02 +00:00
Lars Gullik Bjønnes
77e706c441 fix the smallcaps drawing, move xfont metrics functions out from LyXFont, move non-inlineable functions out of line
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@638 a592a061-630c-0410-9148-cb99ea01b6c8
2000-04-04 00:19:15 +00:00
Lars Gullik Bjønnes
85798535a1 some using changes small changes in lyxfont and some other things, read the Changelog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@632 a592a061-630c-0410-9148-cb99ea01b6c8
2000-03-28 02:18:55 +00:00
Lars Gullik Bjønnes
132fe5e132 the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure that the tables passed to lyxlex is sorted and sort them if not, use std::lower_bound to search in lyxlex tables, use binary search in stead of linear in math_delim::search_deco, we also sort the math_deco_table upon startup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@594 a592a061-630c-0410-9148-cb99ea01b6c8
2000-03-09 03:36:48 +00:00