]> git.lyx.org Git - features.git/commitdiff
introduce test for "equality"
authorAndré Pönitz <poenitz@gmx.net>
Fri, 16 Nov 2001 09:07:40 +0000 (09:07 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 16 Nov 2001 09:07:40 +0000 (09:07 +0000)
remove a few unneeded declarations

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3036 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.h
src/mathed/math_data.C
src/mathed/math_data.h
src/mathed/math_inset.h
src/mathed/math_nestinset.C
src/mathed/math_nestinset.h

index 0df0c4ee612a8938548fc37d178a6795245349fe..0bb6d0063d54d1c937c36209d88d1f0f5b4885d9 100644 (file)
 #include "math_inset.h"
 #include "LString.h"
 
-class MathInset;
-class MathAtom;
-class MathGridInset;
-class MathFuncInset;
-class MathHullInset;
-class MathScriptInset;
-class MathSpaceInset;
 class InsetFormulaBase;
-class MathArray;
-class MathXArray;
 class Painter;
 class Selection;
-class latexkeys;
 
 /// Description of a position 
 struct MathCursorPos {
index e6caaab34acb9ed21c3dcd2390a3c72ab197a746..017742014fa77dafbd317433ed45dc51ac4990e3 100644 (file)
@@ -204,3 +204,14 @@ MathArray::iterator MathArray::end()
 {
        return bf_.end();
 }
+
+
+bool MathArray::match(MathArray const & ar) const
+{
+       if (size() != ar.size())
+               return false;
+       for (const_iterator it = begin(), jt = ar.begin(); it != end(); ++it, ++jt)
+               if (!it->nucleus()->match(jt->nucleus()))
+                       return false;
+       return true;
+}
index 83c3383d4422e5a41e93c88030793acc33c9c4f2..4c5b7fbf0426e8ec71405ba4dd6c95b8185cfb88 100644 (file)
@@ -19,9 +19,7 @@
 #include <vector>
 
 #include "math_atom.h"
-#include "LString.h"
 
-class MathScriptInset;
 class MathMacro;
 class LaTeXFeatures;
 
@@ -104,6 +102,8 @@ public:
        void dump2() const;
        ///
        void substitute(MathMacro const &);
+       ///
+       bool match(MathArray const &) const;
 
        ///
        MathAtom & at(size_type pos);
index b617ed20af942f9bc29028689892bc54b0a9a1a4..9703fa0c9225642ab48547462a20af3183636e34 100644 (file)
@@ -229,6 +229,8 @@ public:
        virtual void validate(LaTeXFeatures & features) const;
        ///
        virtual void handleFont(MathTextCodes) {}
+       ///
+       virtual bool match(MathInset *) const { return false; }
 
        /// write normalized content
        virtual void normalize(NormalStream &) const;
index 03c1c2f04ebc787e77c47b13270ae9a2f475fe3d..4d4cfb6152278e8dd5d2f6aa9225f8319ec90a87 100644 (file)
@@ -178,3 +178,14 @@ bool MathNestInset::covers(int x, int y) const
        }
        return x >= x0 && x <= x1 && y >= y0 && y <= y1;
 }
+
+
+bool MathNestInset::match(MathInset * p) const
+{
+       if (nargs() != p->nargs())
+               return false;
+       for (idx_type i = 0; i < nargs(); ++i)
+               if (!cell(i).match(p->cell(i)))
+                       return false;
+       return true;
+}
index 1416239b63db7b404bb73de958b2cbac1e4d11d1..0108943bc009a2e441cd389abf27b86a119b3e4b 100644 (file)
@@ -65,6 +65,8 @@ public:
        void push_back(MathAtom const &);
        ///
        void dump() const;
+       ///
+       bool match(MathInset *) const;
 
        ///
        void validate(LaTeXFeatures & features) const;