]> git.lyx.org Git - lyx.git/blob - src/lyxlex_pimpl.h
681c0a746ff82ce9d43d7f459a86019527fa0bc4
[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 <stack>
22 #include <vector>
23
24 ///
25 class LyXLex::Pimpl : boost::noncopyable {
26 public:
27         ///
28         Pimpl(keyword_item * tab, int num);
29         ///
30         std::string const getString() const;
31         ///
32         void printError(std::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(std::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(std::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         std::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         std::string pushTok;
78         ///
79         char commentChar;
80 private:
81         ///
82         void verifyTable();
83         ///
84         class pushed_table {
85         public:
86                 ///
87                 pushed_table()
88                         : table_elem(0), table_siz(0) {}
89                 ///
90                 pushed_table(keyword_item * ki, int siz)
91                         : table_elem(ki), table_siz(siz) {}
92                 ///
93                 keyword_item * table_elem;
94                 ///
95                 int table_siz;
96         };
97         ///
98         std::stack<pushed_table> pushed;
99 };
100 #endif