2000-04-08 17:02:02 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file lyxlex_pimpl.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
|
|
|
|
#ifndef LYXLEX_PIMPL_H
|
|
|
|
|
#define LYXLEX_PIMPL_H
|
|
|
|
|
|
|
|
|
|
#include "lyxlex.h"
|
|
|
|
|
|
2006-08-13 22:54:59 +00:00
|
|
|
|
#include "support/types.h"
|
|
|
|
|
|
Replace gzstream by boost::iostreams::gzip_(de)compressor: by Bo Peng (ben.bob@gmail.com)
* src/buffer.C, use filtering_ostream
* src/lyxlex_pimpl.h, .C, use filtering_istreambuf
* src/Makefile.am, src/support/Makefile.am, src/tex2lyx/Makefile.am, use BOOST_IOSTREAMS
* remove src/support/gzstream.h, .C
* add needed boost files boost/boost/iostreams/device/file_descriptor.hpp,
device/mapped_file.hpp, detail/system_failure.hpp,
detail/config/windows_posix.hpp
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13706 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-21 06:42:17 +00:00
|
|
|
|
# include <boost/iostreams/filtering_streambuf.hpp>
|
|
|
|
|
# include <boost/iostreams/filter/gzip.hpp>
|
|
|
|
|
# include <boost/iostreams/device/file.hpp>
|
|
|
|
|
namespace io = boost::iostreams;
|
2003-07-27 23:40:08 +00:00
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
|
#include <boost/utility.hpp>
|
|
|
|
|
|
2005-01-31 15:26:40 +00:00
|
|
|
|
#include <fstream>
|
2005-01-20 21:34:23 +00:00
|
|
|
|
#include <istream>
|
2003-02-13 16:53:15 +00:00
|
|
|
|
#include <stack>
|
2003-04-14 12:44:36 +00:00
|
|
|
|
#include <vector>
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class LyXLex::Pimpl : boost::noncopyable {
|
|
|
|
|
public:
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
Pimpl(keyword_item * tab, int num);
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getString() const;
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring const getDocString() const;
|
2006-08-13 22:54:59 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void printError(std::string const & message) const;
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
void printTable(std::ostream & os);
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
void pushTable(keyword_item * tab, int num);
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
void popTable();
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool setFile(std::string const & filename);
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
void setStream(std::istream & i);
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-11-08 15:19:55 +00:00
|
|
|
|
void setCommentChar(char c);
|
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
bool next(bool esc = false);
|
|
|
|
|
///
|
|
|
|
|
int search_kw(char const * const tag) const;
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
int lex();
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2001-08-06 19:12:46 +00:00
|
|
|
|
bool eatLine();
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
bool nextToken();
|
2000-07-31 16:39:50 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void pushToken(std::string const &);
|
2003-12-02 12:02:39 +00:00
|
|
|
|
/// fb_ is only used to open files, the stream is accessed through is.
|
|
|
|
|
std::filebuf fb_;
|
2005-01-20 21:34:23 +00:00
|
|
|
|
|
2003-12-02 12:02:39 +00:00
|
|
|
|
/// gz_ is only used to open files, the stream is accessed through is.
|
Replace gzstream by boost::iostreams::gzip_(de)compressor: by Bo Peng (ben.bob@gmail.com)
* src/buffer.C, use filtering_ostream
* src/lyxlex_pimpl.h, .C, use filtering_istreambuf
* src/Makefile.am, src/support/Makefile.am, src/tex2lyx/Makefile.am, use BOOST_IOSTREAMS
* remove src/support/gzstream.h, .C
* add needed boost files boost/boost/iostreams/device/file_descriptor.hpp,
device/mapped_file.hpp, detail/system_failure.hpp,
detail/config/windows_posix.hpp
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13706 a592a061-630c-0410-9148-cb99ea01b6c8
2006-04-21 06:42:17 +00:00
|
|
|
|
io::filtering_istreambuf gz_;
|
2003-07-27 23:40:08 +00:00
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
/// the stream that we use.
|
|
|
|
|
std::istream is;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string name;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
|
|
|
|
keyword_item * table;
|
|
|
|
|
///
|
|
|
|
|
int no_items;
|
|
|
|
|
///
|
2006-10-28 15:16:30 +00:00
|
|
|
|
std::string buff;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
2001-10-01 15:31:59 +00:00
|
|
|
|
int status;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
|
|
|
|
int lineno;
|
2000-05-17 14:43:09 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string pushTok;
|
2000-11-08 15:19:55 +00:00
|
|
|
|
///
|
|
|
|
|
char commentChar;
|
2000-08-05 05:17:18 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
void verifyTable();
|
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class pushed_table {
|
|
|
|
|
public:
|
2000-08-05 05:17:18 +00:00
|
|
|
|
///
|
|
|
|
|
pushed_table()
|
|
|
|
|
: table_elem(0), table_siz(0) {}
|
|
|
|
|
///
|
|
|
|
|
pushed_table(keyword_item * ki, int siz)
|
|
|
|
|
: table_elem(ki), table_siz(siz) {}
|
|
|
|
|
///
|
|
|
|
|
keyword_item * table_elem;
|
|
|
|
|
///
|
|
|
|
|
int table_siz;
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
std::stack<pushed_table> pushed;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
#endif
|