]> git.lyx.org Git - lyx.git/blob - src/lyxlex_pimpl.h
remove redundant lyxerr.debugging checks; macro LYXERR already checks whether the...
[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 <istream>
27 #include <stack>
28 #include <vector>
29
30
31 namespace lyx {
32
33 namespace support { class FileName; }
34
35 ///
36 class LyXLex::Pimpl : boost::noncopyable {
37 public:
38         ///
39         Pimpl(keyword_item * tab, int num);
40         ///
41         std::string const getString() const;
42         ///
43         docstring const getDocString() const;
44         ///
45         void printError(std::string const & message) const;
46         ///
47         void printTable(std::ostream & os);
48         ///
49         void pushTable(keyword_item * tab, int num);
50         ///
51         void popTable();
52         ///
53         bool setFile(support::FileName const & filename);
54         ///
55         void setStream(std::istream & i);
56         ///
57         void setCommentChar(char c);
58         ///
59         bool next(bool esc = false);
60         ///
61         int search_kw(char const * const tag) const;
62         ///
63         int lex();
64         ///
65         bool eatLine();
66         ///
67         bool nextToken();
68         /// test if there is a pushed token or the stream is ok
69         bool inputAvailable();
70         ///
71         void pushToken(std::string const &);
72         /// fb_ is only used to open files, the stream is accessed through is.
73         std::filebuf fb_;
74
75         /// gz_ is only used to open files, the stream is accessed through is.
76         io::filtering_istreambuf gz_;
77
78         /// the stream that we use.
79         std::istream is;
80         ///
81         std::string name;
82         ///
83         keyword_item * table;
84         ///
85         int no_items;
86         ///
87         std::string buff;
88         ///
89         int status;
90         ///
91         int lineno;
92         ///
93         std::string pushTok;
94         ///
95         char commentChar;
96 private:
97         ///
98         void verifyTable();
99         ///
100         class pushed_table {
101         public:
102                 ///
103                 pushed_table()
104                         : table_elem(0), table_siz(0) {}
105                 ///
106                 pushed_table(keyword_item * ki, int siz)
107                         : table_elem(ki), table_siz(siz) {}
108                 ///
109                 keyword_item * table_elem;
110                 ///
111                 int table_siz;
112         };
113         ///
114         std::stack<pushed_table> pushed;
115 };
116
117 } // namespace lyx
118
119 #endif