]> git.lyx.org Git - features.git/commitdiff
mathed41.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 6 Mar 2001 10:24:45 +0000 (10:24 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 6 Mar 2001 10:24:45 +0000 (10:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1679 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/array.C
src/mathed/array.h
src/mathed/math_iter.C
src/mathed/math_iter.h

index 3e90e0f0601fd12a89c10ba2c8798947b0a2e0a4..6be2e3dfde315a3603a49ddb2653a38f97f50faa 100644 (file)
@@ -1,5 +1,11 @@
 
-2001-02-14  André Pönitz  <poenitz@htwm.de>
+2001-03-06  André Pönitz  <poenitz@htwm.de>
+       * array.[Ch]: factor out deep_copy,
+         remove third argument from raw_pointer_insert 
+
+       * mathiter.[Ch]: remove unused function Clear() 
+
+2001-03-04  André Pönitz  <poenitz@htwm.de>
   * math_macrotemplate.[Ch]:
     math_macro.C: move update() functionality to the macro
 
index 9004200de8010b4f5c49bb600baabf4780a2cd38..234384cf798626b22e2311ceb862cea1340fca5d 100644 (file)
@@ -60,13 +60,17 @@ MathedArray::MathedArray(MathedArray const & array)
        last_ = array.last_;
 
        // deep copy
-       // we'll not yet get exeption safety
+       deep_copy();
+}
+
+void MathedArray::deep_copy()
+{
        MathedIter it(this);
        while (it.OK()) {
                if (it.IsInset()) {
                        MathedInset * inset = it.GetInset();
                        inset = inset->Clone();
-                       raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
+                       raw_pointer_insert(inset, it.getPos() + 1);
                }
                it.Next();
        }
@@ -200,18 +204,8 @@ void MathedArray::shrink(int pos1, int pos2)
        a.last(dx);
        a[dx] = '\0';
 
-       MathedIter it(&a);
-       it.Reset();
-
-       while (it.OK()) {
-               if (it.IsInset()) {
-                       MathedInset * inset = it.GetInset();
-                       inset = inset->Clone();
-                       a.raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
-               }
-               it.Next();
-       }
        swap(a);
+       deep_copy();
 }
 
 
@@ -261,9 +255,9 @@ MathedInset * MathedArray::getInset(int pos)
 }
 
 #else
-void MathedArray::raw_pointer_insert(void * p, int pos, int len)
+void MathedArray::raw_pointer_insert(void * p, int pos)
 {
-       my_memcpy(&bf_[pos], &p, len);
+       my_memcpy(&bf_[pos], &p, sizeof(p));
 }
 #endif
 
index 158affcdbfb3d6350021e58da569b5394702f70e..f60f84066783768b33a3cfafa0cf7ccedbbf97ad 100644 (file)
@@ -96,7 +96,7 @@ public:
        MathedInset * getInset(int pos);
 #else
        ///
-       void raw_pointer_insert(void * p, int pos, int len);
+       void raw_pointer_insert(void * p, int pos);
 #endif
        ///
        void strange_copy(MathedArray * dest, int dpos, int spos, int len);
@@ -113,6 +113,8 @@ public:
        void need_size(int needed);
        ///
        void dump(std::ostream &) const;
+       /// creates copies of all embedded insets
+       void deep_copy();
 private:
        /// Buffer
        buffer_type bf_;
index 39e32ea0e72e856d02b4a64e4ae9679142d4e4be..23c6b81e0a22e26bcb0c675e6222e6530314f31f 100644 (file)
@@ -325,7 +325,7 @@ void MathedIter::insertInset(MathedInset * p, int type)
        split(shift);
 
        (*array)[pos] = type;
-       array->raw_pointer_insert(p, pos + 1, sizeof(p));
+       array->raw_pointer_insert(p, pos + 1);
        pos += SizeInset;
        (*array)[pos - 1] = type;
        (*array)[array->last()] = '\0';
@@ -376,27 +376,6 @@ bool MathedIter::Delete()
                return false;
 }
 
-
-void MathedIter::Clear()
-{
-       if (!array) {
-               lyxerr << "Math error: Attempting to clean a void array." << endl;
-               return;
-       }
-
-       Reset();
-       while (OK()) {
-               if (IsInset()) {
-                       MathedInset * inset = GetInset();
-                       if (inset->GetType()!= LM_OT_MACRO_ARG)
-                       delete inset;
-                       Delete();
-               } else
-                       Next();
-       }
-}
-
-
 // Check consistency of tabs and crs
 void MathedIter::checkTabs()
 {
index 2706fa2bb6772f8c0a15b4c44348614d1edb41aa..8099bf1f38f3c43549ff89b431a5bbfeba9fc95e 100644 (file)
@@ -110,8 +110,6 @@ public:
        void setNumCols(int n) { ncols = n; }
        ///
        MathedArray * GetData() const;
-       /// Copy every object from position p1 to p2
-       void Clear();
 protected:
        ///
        void split(int);