]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_hullinset.C
forward search in math insets. ugly. seems to work. don't ask why.
[lyx.git] / src / mathed / math_hullinset.C
index 535a7c44c3a6947303cae594c268d58fd93d0805..fa7bdd36ce8733793495f3e09b704cdc169a3b64 100644 (file)
@@ -1,16 +1,21 @@
+#include <config.h>
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <vector>
-
 #include "math_hullinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "math_support.h"
 #include "debug.h"
 #include "Painter.h"
 #include "LaTeXFeatures.h"
-#include "math_mathmlstream.h"
+#include "support/LAssert.h"
+
+#include <vector>
 
+using std::endl;
 
 namespace {
 
@@ -187,6 +192,8 @@ void MathHullInset::draw(Painter & pain, int x, int y) const
 
 string MathHullInset::label(row_type row) const
 {
+       row_type n = nrows();
+       lyx::Assert(row < n);
        return label_[row];
 }
 
@@ -608,7 +615,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
 
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
                        break;
@@ -620,7 +628,8 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
@@ -631,42 +640,45 @@ void MathHullInset::mutate(MathInsetTypes newtype)
                                        break;
                                default:
                                        lyxerr << "mutation from '" << getType()
-                                               << "' to '" << newtype << "' not implemented\n";
+                                               << "' to '" << newtype << "' not implemented"
+                                              << endl;
                                        break;
                        }
 
                default:
                        lyxerr << "mutation from '" << getType()
-                               << "' to '" << newtype << "' not implemented\n";
+                              << "' to '" << newtype << "' not implemented"
+                              << endl;
+                       break;
        }
 }
 
 
 void MathHullInset::write(WriteStream & os) const
 {
-  header_write(os);
-
+       header_write(os);
+       
        bool n = numberedType();
-
+       
        for (row_type row = 0; row < nrows(); ++row) {
                for (col_type col = 0; col < ncols(); ++col) 
-                       os << cell(index(row, col)) << eocString(col).c_str();
+                       os << cell(index(row, col)) << eocString(col);
                if (n) {
                        if (!label_[row].empty())
-                               os << "\\label{" << label_[row].c_str() << "}";
+                               os << "\\label{" << label_[row] << "}";
                        if (nonum_[row])
                                os << "\\nonumber ";
                }
-               os << eolString(row).c_str();
+               os << eolString(row);
        }
-
-  footer_write(os);
+       
+       footer_write(os);
 }
 
 
 void MathHullInset::normalize(NormalStream & os) const
 {
-       os << "[formula " << normalName(getType()).c_str() << " ";
+       os << "[formula " << normalName(getType()) << " ";
        MathGridInset::normalize(os);
        os << "] ";
 }
@@ -678,3 +690,10 @@ void MathHullInset::mathmlize(MathMLStream & os) const
 }
 
 
+void MathHullInset::check() const
+{
+       lyx::Assert(nonum_.size() == nrows());
+       lyx::Assert(label_.size() == nrows());
+}
+
+