]> git.lyx.org Git - features.git/commitdiff
replace a few more naked MathInset * by MathAtom &
authorAndré Pönitz <poenitz@gmx.net>
Thu, 8 Aug 2002 17:11:30 +0000 (17:11 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 8 Aug 2002 17:11:30 +0000 (17:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4907 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/math_data.C
src/mathed/math_deliminset.C
src/mathed/math_diminset.C
src/mathed/math_extern.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_mathmlstream.C
src/mathed/math_mathmlstream.h

index 441767e649f59cb1e6c1bca28eecea66f5cad3f8..31f3de6d14d6dab132072739ccd2c152c79d20e8 100644 (file)
@@ -175,7 +175,7 @@ int InsetFormula::docbook(Buffer const * buf, ostream & os, bool) const
        ms <<    "]]>";
        ms <<   ETag("alt");
        ms <<   MTag("math");
-       ms <<    par_.nucleus();
+       ms <<    par_;
        ms <<   ETag("math");
        ms << ETag("equation");
        return ms.line() + res;
index b99772041ed13bbeee22e73e0bd4d2989a1a9b2e..3b9a0da49dfbf52b8e7161d75f97dd9136b617ce 100644 (file)
@@ -105,7 +105,7 @@ void MathArray::dump2() const
 {
        NormalStream ns(lyxerr);
        for (const_iterator it = begin(); it != end(); ++it)
-               ns << it->nucleus() << ' ';
+               ns << *it << ' ';
 }
 
 
@@ -113,15 +113,14 @@ void MathArray::dump() const
 {
        NormalStream ns(lyxerr);
        for (const_iterator it = begin(); it != end(); ++it)
-               ns << "<" << it->nucleus() << ">";
+               ns << "<" << *it << ">";
 }
 
 
 void MathArray::validate(LaTeXFeatures & features) const
 {
        for (const_iterator it = begin(); it != end(); ++it)
-               if (it->nucleus())
-                       it->nucleus()->validate(features);
+               (*it)->validate(features);
 }
 
 
@@ -137,7 +136,7 @@ bool MathArray::matchpart(MathArray const & ar, pos_type pos) const
                return false;
        const_iterator it = begin() + pos;
        for (const_iterator jt = ar.begin(); jt != ar.end(); ++jt, ++it)
-               if (!jt->nucleus()->match(it->nucleus()))
+               if (!(*jt)->match(it->nucleus()))
                        return false;
        return true;
 }
index ed24aa851d6848d39d462e55d0333cfc77380925..ba50d54e2cab8d508dc6bf456243a49649b18b92 100644 (file)
@@ -132,10 +132,7 @@ bool MathDelimInset::isAbs() const
 void MathDelimInset::maplize(MapleStream & os) const
 {
        if (isAbs()) {
-               bool mat =
-                       cell(0).size() == 1 && cell(0).begin()->nucleus()
-                                       && cell(0).begin()->nucleus()->asMatrixInset();
-               if (mat)
+               if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
                        os << "linalg[det](" << cell(0) << ")";
                else
                        os << "abs(" << cell(0) << ")";
@@ -147,10 +144,7 @@ void MathDelimInset::maplize(MapleStream & os) const
 void MathDelimInset::mathematicize(MathematicaStream & os) const
 {
        if (isAbs()) {
-               bool mat =
-                       cell(0).size() == 1 && cell(0).begin()->nucleus()
-                                       && cell(0).begin()->nucleus()->asMatrixInset();
-               if (mat)
+               if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
                        os << "Det" << cell(0) << ']';
                else
                        os << "Abs[" << cell(0) << ']';
index 783e41a1d565501b2c96ff47d3da9d86c3d23812..88282f0749cec85962b15918cf46047515cc27ff 100644 (file)
@@ -5,17 +5,24 @@
 
 void MathDimInset::metricsT(TextMetricsInfo const &) const
 {
+#ifndef WITH_WARNINGS
+#warning temporarily disabled
+#endif
+/*
        std::ostringstream os;
-       os << *this;
+       os << MathAtom(this);
        dim_.w = int(os.str().size());
        dim_.a = 1;
        dim_.d = 0;
+*/
 }
 
 
-void MathDimInset::drawT(TextPainter & pain, int x, int y) const
+void MathDimInset::drawT(TextPainter &, int, int) const
 {
+/*
        std::ostringstream os;
-       os << *this;
+       os << MathAtom(this);
        pain.draw(x, y, os.str().c_str());
+*/
 }
index 6d24d46352ae6098e34a6d233bc8b81a0496358e..7e32eb9b810fd723c0cbfb73b618c1054f908837 100644 (file)
@@ -865,7 +865,7 @@ void mathmlize(MathArray const & dat, MathMLStream & os)
        if (ar.size() == 0)
                os << "<mrow/>";
        else if (ar.size() == 1)
-               os << ar.begin()->nucleus();
+               os << ar.front();
        else {
                os << MTag("mrow");
                for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
index 52bbd38fc58bd7c04c55d140d8749722b9f82df6..e3a0f3be588aca82aff9068c9198a69858530181 100644 (file)
@@ -46,19 +46,9 @@ int MathInset::height() const
 
 
 ostream & operator<<(ostream & os, MathAtom const & at)
-{
-       if (at.nucleus())
-               os << *(at.nucleus());
-       else
-               os << "(nil)";
-       return os;
-}
-
-
-ostream & operator<<(ostream & os, MathInset const & inset)
 {
        WriteStream wi(os, false, false);
-       inset.write(wi);
+       at->write(wi);
        return os;
 }
 
index d092e1964560b9a3bf6148208b56f9d29442587d..cf01d36ba2c4b5e95b58a03e7e2a7345bdddf67d 100644 (file)
@@ -293,7 +293,6 @@ public:
        virtual string name() const;
 };
 
-std::ostream & operator<<(std::ostream &, MathInset const &);
 std::ostream & operator<<(std::ostream &, MathAtom const &);
 
 string asString(MathArray const & ar);
index 16f96e8625891972966f573de975a912814dbcc2..d7cf3ab39ffa72551e0daacd84350321d412ef94 100644 (file)
@@ -3,7 +3,6 @@
 #include "math_mathmlstream.h"
 #include "math_inset.h"
 #include "math_extern.h"
-#include "debug.h"
 #include "support/lyxalgo.h"
 
 
@@ -16,12 +15,9 @@ MathMLStream::MathMLStream(ostream & os)
 {}
 
 
-MathMLStream & operator<<(MathMLStream & ms, MathInset const * p)
+MathMLStream & operator<<(MathMLStream & ms, MathAtom const & at)
 {
-       if (p)
-               p->mathmlize(ms);
-       else
-               lyxerr << "operator<<(MathMLStream, NULL) called\n";
+       at->mathmlize(ms);
        return ms;
 }
 
@@ -78,12 +74,9 @@ void MathMLStream::cr()
 //////////////////////////////////////////////////////////////////////
 
 
-MapleStream & operator<<(MapleStream & ms, MathInset const * p)
+MapleStream & operator<<(MapleStream & ms, MathAtom const & at)
 {
-       if (p)
-               p->maplize(ms);
-       else
-               lyxerr << "operator<<(MapleStream, NULL) called\n";
+       at->maplize(ms);
        return ms;
 }
 
@@ -119,12 +112,9 @@ MapleStream & operator<<(MapleStream & ms, int i)
 //////////////////////////////////////////////////////////////////////
 
 
-MathematicaStream & operator<<(MathematicaStream & ms, MathInset const * p)
+MathematicaStream & operator<<(MathematicaStream & ms, MathAtom const & at)
 {
-       if (p)
-               p->mathematicize(ms);
-       else
-               lyxerr << "operator<<(MathematicaStream, NULL) called\n";
+       at->mathematicize(ms);
        return ms;
 }
 
@@ -161,12 +151,9 @@ MathematicaStream & operator<<(MathematicaStream & ms, int i)
 //////////////////////////////////////////////////////////////////////
 
 
-OctaveStream & operator<<(OctaveStream & ns, MathInset const * p)
+OctaveStream & operator<<(OctaveStream & ns, MathAtom const & at)
 {
-       if (p)
-               p->octavize(ns);
-       else
-               lyxerr << "operator<<(OctaveStream, NULL) called\n";
+       at->octavize(ns);
        return ns;
 }
 
@@ -202,12 +189,9 @@ OctaveStream & operator<<(OctaveStream & ns, int i)
 //////////////////////////////////////////////////////////////////////
 
 
-NormalStream & operator<<(NormalStream & ns, MathInset const * p)
+NormalStream & operator<<(NormalStream & ns, MathAtom const & at)
 {
-       if (p)
-               p->normalize(ns);
-       else
-               lyxerr << "operator<<(NormalStream, NULL) called\n";
+       at->normalize(ns);
        return ns;
 }
 
@@ -260,12 +244,9 @@ void WriteStream::addlines(unsigned int n)
 }
 
 
-WriteStream & operator<<(WriteStream & ws, MathInset const * p)
+WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
 {
-       if (p)
-               p->write(ws);
-       else
-               lyxerr << "operator<<(WriteStream, NULL) called\n";
+       at->write(ws);
        return ws;
 }
 
@@ -288,10 +269,8 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
 WriteStream & operator<<(WriteStream & ws, char c)
 {
        ws.os() << c;
-       if (c == '\n') {
-               lyxerr << "writing a newline\n";
+       if (c == '\n')
                ws.addlines(1);
-       }
        return ws;
 }
 
index c5e0a31af2c80d3cdaedc0938c93adef4131f869..0163b65a092aa0ddf6263c80718849e58fa87582 100644 (file)
@@ -12,6 +12,7 @@
 
 class MathArray;
 class MathInset;
+class MathAtom;
 
 
 //
@@ -58,7 +59,7 @@ private:
 };
 
 ///
-MathMLStream & operator<<(MathMLStream &, MathInset const *);
+MathMLStream & operator<<(MathMLStream &, MathAtom const &);
 ///
 MathMLStream & operator<<(MathMLStream &, MathArray const &);
 ///
@@ -88,7 +89,7 @@ private:
 };
 
 ///
-NormalStream & operator<<(NormalStream &, MathInset const *);
+NormalStream & operator<<(NormalStream &, MathAtom const &);
 ///
 NormalStream & operator<<(NormalStream &, MathArray const &);
 ///
@@ -119,7 +120,7 @@ private:
 
 
 ///
-MapleStream & operator<<(MapleStream &, MathInset const *);
+MapleStream & operator<<(MapleStream &, MathAtom const &);
 ///
 MapleStream & operator<<(MapleStream &, MathArray const &);
 ///
@@ -148,7 +149,7 @@ private:
 
 
 ///
-MathematicaStream & operator<<(MathematicaStream &, MathInset const *);
+MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
 ///
 MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
 ///
@@ -176,7 +177,7 @@ private:
 };
 
 ///
-OctaveStream & operator<<(OctaveStream &, MathInset const *);
+OctaveStream & operator<<(OctaveStream &, MathAtom const &);
 ///
 OctaveStream & operator<<(OctaveStream &, MathArray const &);
 ///
@@ -224,7 +225,7 @@ private:
 };
 
 ///
-WriteStream & operator<<(WriteStream &, MathInset const *);
+WriteStream & operator<<(WriteStream &, MathAtom const &);
 ///
 WriteStream & operator<<(WriteStream &, MathArray const &);
 ///