]> git.lyx.org Git - lyx.git/blobdiff - src/texstream.h
Fix bug #7404.
[lyx.git] / src / texstream.h
index e5450ce7417a53a84b77672fcd69225d56c6b4ec..a14f84bf95fec38f64fe101b594c513a6d6532c9 100644 (file)
@@ -81,7 +81,8 @@ public:
        ///
        explicit otexstream(odocstream & os)
                : otexrowstream(os), canbreakline_(false),
-                 protectspace_(false), parbreak_(true), lastchar_(0) {}
+                 protectspace_(false), terminate_command_(false),
+                 parbreak_(true), blankline_(true), lastchar_(0) {}
        ///
        void put(char_type const & c);
        ///
@@ -95,9 +96,14 @@ public:
        ///
        bool protectSpace() const { return protectspace_; }
        ///
+       void terminateCommand(bool terminate) { terminate_command_ = terminate; }
+       ///
+       bool terminateCommand() const { return terminate_command_; }
+       ///
        void lastChar(char_type const & c)
        {
                parbreak_ = (!canbreakline_ && c == '\n');
+               blankline_ = ((!canbreakline_ && c == ' ') || c == '\n');
                canbreakline_ = (c != '\n');
                lastchar_ = c;
        }
@@ -105,14 +111,20 @@ public:
        char_type lastChar() const { return lastchar_; }
        ///
        bool afterParbreak() const { return parbreak_; }
+       ///
+       bool blankLine() const { return blankline_; }
 private:
        ///
        bool canbreakline_;
        ///
        bool protectspace_;
        ///
+       bool terminate_command_;
+       ///
        bool parbreak_;
        ///
+       bool blankline_;
+       ///
        char_type lastchar_;
 };
 
@@ -144,14 +156,22 @@ struct SafeBreakLine {
        char n;
 };
 
+/// Helper structs for terminating a command
+struct TerminateCommand {
+       char n;
+};
+
 extern BreakLine breakln;
 extern SafeBreakLine safebreakln;
+extern TerminateCommand termcmd;
 
 ///
 otexstream & operator<<(otexstream &, BreakLine);
 ///
 otexstream & operator<<(otexstream &, SafeBreakLine);
 ///
+otexstream & operator<<(otexstream &, TerminateCommand);
+///
 otexstream & operator<<(otexstream &, odocstream_manip);
 ///
 otexstream & operator<<(otexstream &, TexString);
@@ -168,6 +188,6 @@ template <typename Type>
 otexstream & operator<<(otexstream & ots, Type value);
 
 
-}
+} // namespace lyx
 
 #endif