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