+// -*- C++ -*-
+/**
+ * \file math_mathmlstream.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
#ifndef MATH_MATHMLSTREAM_H
#define MATH_MATHMLSTREAM_H
// settled.
+#include "metricsinfo.h"
+
#include <iosfwd>
class MathArray;
class MathInset;
+class MathAtom;
+
+//
+// LaTeX/LyX
+//
+
+class WriteStream {
+public:
+ ///
+ WriteStream(std::ostream & os, bool fragile, bool latex);
+ ///
+ explicit WriteStream(std::ostream & os);
+ ///
+ ~WriteStream();
+ ///
+ int line() const { return line_; }
+ ///
+ bool fragile() const { return fragile_; }
+ ///
+ bool latex() const { return latex_; }
+ ///
+ std::ostream & os() { return os_; }
+ ///
+ bool & firstitem() { return firstitem_; }
+ ///
+ void addlines(unsigned int);
+ /// writes space if next thing is isalpha()
+ void pendingSpace(bool how);
+ /// writes space if next thing is isalpha()
+ bool pendingSpace() const { return pendingspace_; }
+private:
+ ///
+ std::ostream & os_;
+ /// do we have to write \\protect sometimes
+ bool fragile_;
+ /// are we at the beginning of an MathArray?
+ bool firstitem_;
+ /// are we writing to .tex?
+ int latex_;
+ /// do we have a space pending?
+ bool pendingspace_;
+ ///
+ int line_;
+};
+
+///
+WriteStream & operator<<(WriteStream &, MathAtom const &);
+///
+WriteStream & operator<<(WriteStream &, MathArray const &);
+///
+WriteStream & operator<<(WriteStream &, char const *);
+///
+WriteStream & operator<<(WriteStream &, char);
+///
+WriteStream & operator<<(WriteStream &, int);
+///
+WriteStream & operator<<(WriteStream &, unsigned int);
+
//
};
///
-MathMLStream & operator<<(MathMLStream &, MathInset const *);
+MathMLStream & operator<<(MathMLStream &, MathAtom const &);
///
MathMLStream & operator<<(MathMLStream &, MathArray const &);
///
};
///
-NormalStream & operator<<(NormalStream &, MathInset const *);
+NormalStream & operator<<(NormalStream &, MathAtom const &);
///
NormalStream & operator<<(NormalStream &, MathArray const &);
///
NormalStream & operator<<(NormalStream &, int);
-
-
//
// Maple
//
///
-MapleStream & operator<<(MapleStream &, MathInset const *);
+MapleStream & operator<<(MapleStream &, MathAtom const &);
///
MapleStream & operator<<(MapleStream &, MathArray const &);
///
//
-// Mathematica
+// Maxima
//
-class MathematicaStream {
+class MaximaStream {
public:
///
- explicit MathematicaStream(std::ostream & os) : os_(os) {}
+ explicit MaximaStream(std::ostream & os) : os_(os) {}
///
std::ostream & os() { return os_; }
private:
///
-MathematicaStream & operator<<(MathematicaStream &, MathInset const *);
+MaximaStream & operator<<(MaximaStream &, MathAtom const &);
///
-MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
+MaximaStream & operator<<(MaximaStream &, MathArray const &);
///
-MathematicaStream & operator<<(MathematicaStream &, char const *);
+MaximaStream & operator<<(MaximaStream &, char const *);
///
-MathematicaStream & operator<<(MathematicaStream &, char);
+MaximaStream & operator<<(MaximaStream &, char);
///
-MathematicaStream & operator<<(MathematicaStream &, int);
+MaximaStream & operator<<(MaximaStream &, int);
//
-// Octave
+// Mathematica
//
-class OctaveStream {
+class MathematicaStream {
public:
///
- explicit OctaveStream(std::ostream & os) : os_(os) {}
+ explicit MathematicaStream(std::ostream & os) : os_(os) {}
///
std::ostream & os() { return os_; }
private:
std::ostream & os_;
};
+
///
-OctaveStream & operator<<(OctaveStream &, MathInset const *);
+MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
///
-OctaveStream & operator<<(OctaveStream &, MathArray const &);
+MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
///
-OctaveStream & operator<<(OctaveStream &, char const *);
+MathematicaStream & operator<<(MathematicaStream &, char const *);
///
-OctaveStream & operator<<(OctaveStream &, char);
+MathematicaStream & operator<<(MathematicaStream &, char);
///
-OctaveStream & operator<<(OctaveStream &, int);
-
+MathematicaStream & operator<<(MathematicaStream &, int);
//
-// LaTeX/LyX
+// Octave
//
-class WriteStream {
+
+class OctaveStream {
public:
///
- WriteStream(std::ostream & os, bool fragile, bool latex);
- ///
- explicit WriteStream(std::ostream & os_);
- ///
- int line() const { return line_; }
- ///
- bool fragile() const { return fragile_; }
- ///
- bool latex() const { return latex_; }
+ explicit OctaveStream(std::ostream & os) : os_(os) {}
///
std::ostream & os() { return os_; }
- ///
- bool & firstitem() { return firstitem_; }
- ///
- void addlines(unsigned int);
private:
///
std::ostream & os_;
- ///
- bool fragile_;
- /// are we writing to .tex?
- int latex_;
- /// are we at the beginning of an MathArray?
- bool firstitem_;
- ///
- int line_;
};
///
-WriteStream & operator<<(WriteStream &, MathInset const *);
-///
-WriteStream & operator<<(WriteStream &, MathArray const &);
+OctaveStream & operator<<(OctaveStream &, MathAtom const &);
///
-WriteStream & operator<<(WriteStream &, char const *);
+OctaveStream & operator<<(OctaveStream &, MathArray const &);
///
-WriteStream & operator<<(WriteStream &, char);
+OctaveStream & operator<<(OctaveStream &, char const *);
///
-WriteStream & operator<<(WriteStream &, int);
+OctaveStream & operator<<(OctaveStream &, char);
///
-WriteStream & operator<<(WriteStream &, unsigned int);
+OctaveStream & operator<<(OctaveStream &, int);
+
+
#endif