]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Parser.h
Pimpl MathMacro
[lyx.git] / src / tex2lyx / Parser.h
index 28d5017bdff650531ef266ebf0dfc4ecd25cec09..9778765ed6f2dce76c8c244f16e13576a64ae9ea 100644 (file)
@@ -123,13 +123,20 @@ class iparserdocstream
 public:
        typedef idocstream::int_type int_type;
 
-       iparserdocstream(idocstream & is) : is_(is) {};
+       iparserdocstream(idocstream & is) : is_(is) {}
 
+#if (__cplusplus > 199711L)
        /// 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; }
+#else
+       /// Like std::istream::operator void*()
+       operator void*() const { return (s_.empty() && is_.fail()) ?
+                       0 : const_cast<iparserdocstream *>(this); }
+#endif
 
        /// 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
@@ -172,7 +179,7 @@ class Parser {
        Parser & operator=(Parser const & p);
 public:
        ///
-       Parser(idocstream & is);
+       Parser(idocstream & is, std::string const & fixedenc);
        ///
        Parser(std::string const & s);
        ///
@@ -351,10 +358,12 @@ private:
        std::string encoding_iconv_;
        ///
        CatCode theCatcode_[256];
-       //
+       ///
        cat_type theCatcodesType_;
-       //
+       ///
        cat_type curr_cat_;
+       ///
+       bool fixed_enc_;
 };