]> git.lyx.org Git - lyx.git/blob - src/lyxlex_pimpl.h
Revert change in rev. 15955 because as Georg says:
[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/types.h"
18
19 # include <boost/iostreams/filtering_streambuf.hpp>
20 # include <boost/iostreams/filter/gzip.hpp>
21 # include <boost/iostreams/device/file.hpp>
22 namespace io = boost::iostreams;
23
24 #include <boost/utility.hpp>
25
26 #include <fstream>
27 #include <istream>
28 #include <stack>
29 #include <vector>
30
31
32 namespace lyx {
33
34 ///
35 class LyXLex::Pimpl : boost::noncopyable {
36 public:
37         ///
38         Pimpl(keyword_item * tab, int num);
39         ///
40         std::string const getString() const;
41         ///
42         docstring const getDocString() const;
43         ///
44         void printError(std::string const & message) const;
45         ///
46         void printTable(std::ostream & os);
47         ///
48         void pushTable(keyword_item * tab, int num);
49         ///
50         void popTable();
51         ///
52         bool setFile(std::string const & filename);
53         ///
54         void setStream(std::istream & i);
55         ///
56         void setCommentChar(char c);
57         ///
58         bool next(bool esc = false);
59         ///
60         int search_kw(char const * const tag) const;
61         ///
62         int lex();
63         ///
64         bool eatLine();
65         ///
66         bool nextToken();
67         ///
68         void pushToken(std::string const &);
69         /// fb_ is only used to open files, the stream is accessed through is.
70         std::filebuf fb_;
71
72         /// gz_ is only used to open files, the stream is accessed through is.
73         io::filtering_istreambuf gz_;
74
75         /// the stream that we use.
76         std::istream is;
77         ///
78         std::string name;
79         ///
80         keyword_item * table;
81         ///
82         int no_items;
83         ///
84         std::string buff;
85         ///
86         int status;
87         ///
88         int lineno;
89         ///
90         std::string pushTok;
91         ///
92         char commentChar;
93 private:
94         ///
95         void verifyTable();
96         ///
97         class pushed_table {
98         public:
99                 ///
100                 pushed_table()
101                         : table_elem(0), table_siz(0) {}
102                 ///
103                 pushed_table(keyword_item * ki, int siz)
104                         : table_elem(ki), table_siz(siz) {}
105                 ///
106                 keyword_item * table_elem;
107                 ///
108                 int table_siz;
109         };
110         ///
111         std::stack<pushed_table> pushed;
112 };
113
114 } // namespace lyx
115
116 #endif