]> git.lyx.org Git - lyx.git/blob - src/lyxlex_pimpl.h
add comment
[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         ///
69         void pushToken(std::string const &);
70         /// fb_ is only used to open files, the stream is accessed through is.
71         std::filebuf fb_;
72
73         /// gz_ is only used to open files, the stream is accessed through is.
74         io::filtering_istreambuf gz_;
75
76         /// the stream that we use.
77         std::istream is;
78         ///
79         std::string name;
80         ///
81         keyword_item * table;
82         ///
83         int no_items;
84         ///
85         std::string buff;
86         ///
87         int status;
88         ///
89         int lineno;
90         ///
91         std::string pushTok;
92         ///
93         char commentChar;
94 private:
95         ///
96         void verifyTable();
97         ///
98         class pushed_table {
99         public:
100                 ///
101                 pushed_table()
102                         : table_elem(0), table_siz(0) {}
103                 ///
104                 pushed_table(keyword_item * ki, int siz)
105                         : table_elem(ki), table_siz(siz) {}
106                 ///
107                 keyword_item * table_elem;
108                 ///
109                 int table_siz;
110         };
111         ///
112         std::stack<pushed_table> pushed;
113 };
114
115 } // namespace lyx
116
117 #endif