Consider the case where there is not any layout name.
[lyx.git] / src / lyxlex_pimpl.h
blob79f4393acef51621bf74b71f86cf0513b947fc12
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.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef LYXLEX_PIMPL_H
13 #define LYXLEX_PIMPL_H
15 #include "lyxlex.h"
17 #ifdef USE_COMPRESSION
18 # include "support/gzstream.h"
19 #endif
21 #include <boost/utility.hpp>
23 #include <fstream>
24 #include <istream>
25 #include <stack>
26 #include <vector>
28 ///
29 class LyXLex::Pimpl : boost::noncopyable {
30 public:
31 ///
32 Pimpl(keyword_item * tab, int num);
33 ///
34 std::string const getString() const;
35 ///
36 void printError(std::string const & message) const;
37 ///
38 void printTable(std::ostream & os);
39 ///
40 void pushTable(keyword_item * tab, int num);
41 ///
42 void popTable();
43 ///
44 bool setFile(std::string const & filename);
45 ///
46 void setStream(std::istream & i);
47 ///
48 void setCommentChar(char c);
49 ///
50 bool next(bool esc = false);
51 ///
52 int search_kw(char const * const tag) const;
53 ///
54 int lex();
55 ///
56 bool eatLine();
57 ///
58 bool nextToken();
59 ///
60 void pushToken(std::string const &);
61 /// fb_ is only used to open files, the stream is accessed through is.
62 std::filebuf fb_;
64 #ifdef USE_COMPRESSION
65 /// gz_ is only used to open files, the stream is accessed through is.
66 gz::gzstreambuf gz_;
67 #endif
69 /// the stream that we use.
70 std::istream is;
71 ///
72 std::string name;
73 ///
74 keyword_item * table;
75 ///
76 int no_items;
77 ///
78 std::vector<char> buff;
79 ///
80 int status;
81 ///
82 int lineno;
83 ///
84 std::string pushTok;
85 ///
86 char commentChar;
87 private:
88 ///
89 void verifyTable();
90 ///
91 class pushed_table {
92 public:
93 ///
94 pushed_table()
95 : table_elem(0), table_siz(0) {}
96 ///
97 pushed_table(keyword_item * ki, int siz)
98 : table_elem(ki), table_siz(siz) {}
99 ///
100 keyword_item * table_elem;
102 int table_siz;
105 std::stack<pushed_table> pushed;
107 #endif