]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbolinset.C
enable direct input of #1...#9; some whitespace changes
[lyx.git] / src / mathed / math_symbolinset.C
index 4b635efbd51921db89835dc5779b44fe369bec39..c861d5c94289f70744f7543a7af01f1b61eee024 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,14 +143,21 @@ 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 << "> ";
        if (sym_->xmlname == "x") // unknown so far
-               os << name().c_str();
+               os << name();
        else
-               os << sym_->xmlname.c_str();
+               os << sym_->xmlname;
        os << " </" << type << '>';
 }
 
@@ -152,13 +167,13 @@ 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() << ' ';
 }