]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMath.C
fix reading UTF8 encoded symbol file
[lyx.git] / src / mathed / InsetMath.C
index 0d8aee7e40cfb479e65a6274112bdbdf0038ef4c..2a6d4462a43b9dc5432e719dd8af726445e56432 100644 (file)
 
 #include "InsetMath.h"
 #include "MathData.h"
-#include "MathMLStream.h"
+#include "MathStream.h"
 #include "debug.h"
 
 #include "support/lstrings.h"
 
 #include <boost/current_function.hpp>
 
-using lyx::odocstream;
 
-using std::string;
+namespace lyx {
+
 using std::endl;
 
 
@@ -45,10 +45,10 @@ MathArray const & InsetMath::cell(idx_type) const
 void InsetMath::dump() const
 {
        lyxerr << "---------------------------------------------" << endl;
-       lyx::odocstringstream os;
+       odocstringstream os;
        WriteStream wi(os, false, true);
        write(wi);
-       lyxerr << lyx::to_utf8(os.str());
+       lyxerr << to_utf8(os.str());
        lyxerr << "\n---------------------------------------------" << endl;
 }
 
@@ -72,8 +72,8 @@ void InsetMath::drawT(TextPainter &, int, int) const
 
 void InsetMath::write(WriteStream & os) const
 {
-       string const s = name();
-       os << '\\' << s.c_str();
+       docstring const s = name();
+       os << "\\" << s;
        // We need an extra ' ' unless this is a single-char-non-ASCII name
        // or anything non-ASCII follows
        if (s.size() != 1 || isalpha(s[0]))
@@ -83,7 +83,7 @@ void InsetMath::write(WriteStream & os) const
 
 void InsetMath::normalize(NormalStream & os) const
 {
-       os << '[' << name().c_str() << "] ";
+       os << '[' << name() << "] ";
 }
 
 
@@ -115,7 +115,7 @@ void InsetMath::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMath::mathmlize(MathMLStream & os) const
+void InsetMath::mathmlize(MathStream & os) const
 {
         NormalStream ns(os.os());
         normalize(ns);
@@ -128,18 +128,18 @@ HullType InsetMath::getType() const
 }
 
 
-string InsetMath::name() const
+docstring InsetMath::name() const
 {
-       return "unknown";
+       return from_ascii("unknown");
 }
 
 
 std::ostream & operator<<(std::ostream & os, MathAtom const & at)
 {
-       lyx::odocstringstream oss;
+       odocstringstream oss;
        WriteStream wi(oss, false, false);
        at->write(wi);
-       return os << lyx::to_utf8(oss.str());
+       return os << to_utf8(oss.str());
 }
 
 
@@ -149,3 +149,6 @@ odocstream & operator<<(odocstream & os, MathAtom const & at)
        at->write(wi);
        return os;
 }
+
+
+} // namespace lyx