]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathStream.h
Whitespace.
[lyx.git] / src / mathed / MathStream.h
index e93cef123d410480a4caaefe9dfde48b1537532b..99900c3c112918fd94c654d276feb7d5e8ac7129 100644 (file)
@@ -242,6 +242,7 @@ public:
        char const * const tag_;
 };
 
+
 class MathStream {
 public:
        ///
@@ -256,7 +257,19 @@ public:
        int & tab() { return tab_; }
        ///
        friend MathStream & operator<<(MathStream &, char const *);
+       ///
+       void defer(docstring const &);
+       ///
+       void defer(std::string const &);
+       ///
+       docstring deferred() const;
+       ///
+       bool inText() const { return in_text_; }
 private:
+       ///
+       void setTextMode() { in_text_ = true; }
+       ///
+       void setMathMode() { in_text_ = false; }
        ///
        odocstream & os_;
        ///
@@ -265,6 +278,12 @@ private:
        int line_;
        ///
        char lastchar_;
+       ///
+       bool in_text_;
+       ///
+       odocstringstream deferred_;
+       ///
+       friend class SetMode;
 };
 
 ///
@@ -278,11 +297,41 @@ MathStream & operator<<(MathStream &, char const *);
 ///
 MathStream & operator<<(MathStream &, char);
 ///
+MathStream & operator<<(MathStream &, char_type);
+///
 MathStream & operator<<(MathStream &, MTag const &);
 ///
 MathStream & operator<<(MathStream &, ETag const &);
 
 
+/// A simpler version of ModeSpecifier, for MathML
+// FIXME There are still problems here with nesting, at least
+// potentially. The problem is that true nesting of text mode isn't
+// actually possible. I.e., we can't have: 
+//             <mtext><mtext></mtext></mtext>
+// So we have to have:
+//             <mtext></mtext><mtext></mtext><mtext></mtext>
+// instead, where the last is really a continuation of the first.
+// We'll need some kind of stack to remember all that.
+class SetMode {
+public:
+       ///
+       explicit SetMode(MathStream & os, bool text, docstring attrs);
+       ///
+       explicit SetMode(MathStream & os, bool text);
+       ///
+       ~SetMode();
+private:
+       ///
+       void init(bool, docstring);
+       ///
+       MathStream & os_;
+       ///
+       bool opened_;
+       ///
+       bool was_text_;
+};
+
 
 //
 // Debugging