public:
typedef idocstream::int_type int_type;
- iparserdocstream(idocstream & is) : is_(is) {};
+ iparserdocstream(idocstream & is) : is_(is) {}
/// Like std::istream::operator bool()
- operator bool() const { return s_.empty() ? is_ : true; }
+ /// Do not convert is_ implicitly to bool, since that is forbidden in C++11.
+ explicit operator bool() const { return s_.empty() ? !is_.fail() : true; }
/// change the encoding of the input stream to \p e (iconv name)
- bool setEncoding(std::string const & e);
+ void setEncoding(std::string const & e);
// add to the list of characters to read before actually reading
// the stream
void putback(char_type c);
- // add before the list of characters to read before actually reading
+ // add to the list of characters to read before actually reading
// the stream
- void put_almost_back(docstring s);
+ void putback(docstring s);
/// Like std::istream::get()
iparserdocstream & get(char_type &c);
Parser & operator=(Parser const & p);
public:
///
- Parser(idocstream & is);
+ Parser(idocstream & is, std::string const & fixedenc);
///
Parser(std::string const & s);
///
void pushPosition();
/// restore previous position
void popPosition();
+ /// forget last saved position
+ void dropPosition();
/// dump contents to screen
void dump() const;
* stopped at string \p end_string. Contrary to the other
* methods, this uses proper catcode setting. This function is
* designed to parse verbatim environments and command. The
- * intention is to eventually replace all of its siblings.
+ * intention is to eventually replace all of its siblings. the
+ * member \p first of the result tells whether the arg was
+ * found and the member \p second is the value. If \p
+ * allow_linebreak is false, then the parsing is limited to one line
*/
- std::string const verbatimStuff(std::string const & end_string);
+ Arg verbatimStuff(std::string const & end_string,
+ bool allow_linebreak = true);
/*
* \returns the contents of the environment \p name.
* <tt>\begin{name}</tt> must be parsed already,
std::string encoding_iconv_;
///
CatCode theCatcode_[256];
- //
+ ///
cat_type theCatcodesType_;
- //
+ ///
cat_type curr_cat_;
+ ///
+ bool fixed_enc_;
};