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