]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbolinset.C
infrastructure for requiring "amssymb".
[lyx.git] / src / mathed / math_symbolinset.C
index b2855ac9f2b739d28b3fb5274f8ee8f78f6772cd..f2f0f5c6a2273a88990a9af1558fd148f7c4a4ff 100644 (file)
@@ -1,5 +1,8 @@
+#include <config.h>
+
 #include "math_symbolinset.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 #include "math_parser.h"
 #include "debug.h"
@@ -15,6 +18,11 @@ MathSymbolInset::MathSymbolInset(const char * name)
 {}
 
 
+MathSymbolInset::MathSymbolInset(string const & name)
+       : sym_(in_word_set(name.c_str())), h_(0)
+{}
+
+
 
 MathInset * MathSymbolInset::clone() const
 {
@@ -114,7 +122,7 @@ bool MathSymbolInset::takesLimits() const
 
 void MathSymbolInset::normalize(NormalStream & os) const
 {
-       os << "[symbol " << name().c_str() << "]";
+       os << "[symbol " << name() << "]";
 }
 
 
@@ -123,7 +131,7 @@ void MathSymbolInset::maplize(MapleStream & os) const
        if (name() == "cdot")
                os << '*';
        else
-               os << name().c_str();
+               os << name();
 }
 
 
@@ -135,10 +143,22 @@ char const * MathMLtype(string const & s)
 }
 
 
+bool MathSymbolInset::match(MathInset * p) const
+{
+       MathSymbolInset const * q = p->asSymbolInset();
+       return q && name() == q->name();
+}
+
+
 void MathSymbolInset::mathmlize(MathMLStream & os) const
 {
        char const * type = MathMLtype(sym_->type);
-       os << '<' << type << "> " << name().c_str() << " </" << type << '>';
+       os << '<' << type << "> ";
+       if (sym_->xmlname == "x") // unknown so far
+               os << name();
+       else
+               os << sym_->xmlname;
+       os << " </" << type << '>';
 }
 
 
@@ -147,13 +167,24 @@ void MathSymbolInset::octavize(OctaveStream & os) const
        if (name() == "cdot")
                os << '*';
        else
-               os << name().c_str();
+               os << name();
 }
 
 
 void MathSymbolInset::write(WriteStream & os) const
 {
-       os << '\\' << name().c_str() << ' ';
+       os << '\\' << name() << ' ';
 }
 
 
+void MathSymbolInset::infoize(std::ostream & os) const
+{
+       os << '\\' << name();
+}
+
+
+void MathSymbolInset::validate(LaTeXFeatures & features) const
+{
+       // if (...)
+       //      features.require("amssymb");
+}