]> git.lyx.org Git - lyx.git/blob - src/lyxlex_pimpl.h
work around for bug reported by Mario Morandini
[lyx.git] / src / lyxlex_pimpl.h
1 // -*- C++ -*-
2
3 #ifndef LYXLEX_PIMPL_H
4 #define LYXLEX_PIMPL_H
5
6 #include <fstream>
7 #include <stack>
8 #include <boost/utility.hpp>
9
10 #include "lyxlex.h"
11
12 #ifdef __GNUG__
13 #pragma interface
14 #endif
15
16 ///
17 struct LyXLex::Pimpl : boost::noncopyable {
18         ///
19         enum {
20                 ///
21                 LEX_MAX_BUFF = 2048
22         };
23
24         ///
25         Pimpl(keyword_item * tab, int num);
26         ///
27         string const getString() const;
28         ///
29         void printError(string const & message) const;
30         ///
31         void printTable(std::ostream & os);
32         ///
33         void pushTable(keyword_item * tab, int num);
34         ///
35         void popTable();
36         ///
37         bool setFile(string const & filename);
38         ///
39         void setStream(std::istream & i);
40         ///
41         void setCommentChar(char c);
42         ///
43         bool next(bool esc = false);
44         ///
45         int search_kw(char const * const tag) const;
46         ///
47         int lex();
48         ///
49         bool eatLine();
50         ///
51         bool nextToken();
52         ///
53         void pushToken(string const &);
54         /// fb__ is only used to open files, the stream is accessed through is
55         std::filebuf fb__;
56         /// the stream that we use.
57         std::istream is;
58         ///
59         string name;
60         ///
61         keyword_item * table;
62         ///
63         int no_items;
64         ///
65         char buff[LEX_MAX_BUFF];
66         ///
67         int status;
68         ///
69         int lineno;
70         ///
71         string pushTok;
72         ///
73         char commentChar;
74 private:
75         ///
76         void verifyTable();
77         ///
78         struct pushed_table {
79                 ///
80                 pushed_table()
81                         : table_elem(0), table_siz(0) {}
82                 ///
83                 pushed_table(keyword_item * ki, int siz)
84                         : table_elem(ki), table_siz(siz) {}
85                 ///
86                 keyword_item * table_elem;
87                 ///
88                 int table_siz;
89         };
90         ///
91         std::stack<pushed_table> pushed;
92 };
93 #endif