]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlMath.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlMath.C
index dccfdce253f310fd39db6ce86c7c25acc240fa6f..3eae5af11da867d0c4916803a4ddaed9d5448cfe 100644 (file)
 #include "support/lstrings.h"
 #include "support/filetools.h"
 
-using lyx::support::compare;
-using lyx::support::LibFileSearch;
-using lyx::support::subst;
+#include <functional>
 
 using std::string;
 
+namespace lyx {
+
+using support::compare;
+using support::LibFileSearch;
+using support::subst;
+
+namespace frontend {
 
 ControlMath::ControlMath(Dialog & dialog)
        : Dialog::Controller(dialog)
@@ -174,7 +179,7 @@ char const * latex_misc[] = {
        "angle", "top", "bot", "Vert", "neg",
        "flat", "natural", "sharp", "surd", "triangle",
        "diamondsuit", "heartsuit", "clubsuit", "spadesuit",
-       "textrm Å", "textrm Ø", "mathcircumflex", "_",
+       "textrm \\AA", "textrm \\O", "mathcircumflex", "_",
        "mathrm T",
        "mathbb N", "mathbb Z", "mathbb Q",
        "mathbb R", "mathbb C", "mathbb H",
@@ -288,10 +293,11 @@ bool operator<(XPMmap const & lhs, XPMmap const & rhs)
 }
 
 
-struct CompareKey {
+class CompareKey : public std::unary_function<XPMmap, bool> {
+public:
        CompareKey(string const & name) : name_(name) {}
-       bool operator()(XPMmap const & other) {
-               return compare(other.key, name_.c_str()) == 0;
+       bool operator()(XPMmap const & other) const {
+               return other.key == name_;
        }
 private:
        string const name_;
@@ -330,8 +336,8 @@ XPMmap sorted_xpm_map[] = {
        { "nRightarrow", "nrightarrow2" },
        { "nVDash", "nvdash3" },
        { "nvDash", "nvdash2" },
-       { "textrm_Å", "textrm_A" },
-       { "textrm_Ø", "textrm_0" },
+       { "textrm \\AA", "textrm_AA"},
+       { "textrm \\O", "textrm_Oe"},
        { "vDash", "vdash2" }
 };
 
@@ -344,7 +350,7 @@ string const find_xpm(string const & name)
 {
        XPMmap const * const begin = sorted_xpm_map;
        XPMmap const * const end = begin + nr_sorted_xpm_map;
-       BOOST_ASSERT(lyx::sorted(begin, end));
+       BOOST_ASSERT(sorted(begin, end));
 
        XPMmap const * const it =
                std::find_if(begin, end, CompareKey(name));
@@ -372,3 +378,6 @@ string const find_xpm(string const & name)
 
        return LibFileSearch("images/math/", xpm_name, "xpm");
 }
+
+} // namespace frontend
+} // namespace lyx