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