From 8e77078e603f4bad68d4845a1bf088d0743693d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 8 Mar 2001 22:19:55 +0000 Subject: [PATCH] mathed50.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1719 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 6 +++++ src/mathed/math_matrixinset.C | 41 ----------------------------------- src/mathed/math_matrixinset.h | 6 ----- src/mathed/math_rowst.h | 29 ++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 48 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 86046e7be0..bf4db3ce13 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -3,6 +3,12 @@ * math_xiter.C: new 'container()' method to encapsulated access to the MathParInset's MathedRowContainer + + * math_rowst.h: proper copy constructor and destructor for + MathedRowContainer + + * math_matrixinset.[hC]: remove copy constructr and destructor. Those + automatically created by the compiler are ok now. 2001-03-06 André Pönitz * array.[Ch]: factor out deep_copy, diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index cd9d291a31..30842ab21a 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -35,47 +35,6 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st) } -MathMatrixInset::MathMatrixInset(MathMatrixInset const & mt) - : MathParInset(mt.GetStyle(), mt.GetName(), mt.GetType()), - nc_(mt.nc_), nr_(0), ws_(mt.nc_), - v_align_(mt.v_align_), h_align_(mt.h_align_) -{ - array = mt.GetData(); - if (!mt.row_.empty()) { - MathedRowSt * ro = 0; - MathedRowSt * mrow = mt.row_.data_; - - while (mrow) { - MathedRowSt * r = new MathedRowSt(nc_ + 1); - r->setNumbered(mrow->isNumbered()); - //if (mrow->label) - r->setLabel(mrow->getLabel()); - if (!ro) - row_.data_ = r; - else - ro->next_ = r; - mrow = mrow->next_; - ro = r; - ++nr_; - } - } else - row_.data_ = 0; - flag = mt.flag; -} - - -MathMatrixInset::~MathMatrixInset() -{ - MathedRowSt * r = row_.data_; - while (r) { - MathedRowSt * q = r->next_; - delete r; - r = q; - } -} - - - MathedInset * MathMatrixInset::Clone() { return new MathMatrixInset(*this); diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index 8561d72a3b..a3f5963979 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -18,14 +18,8 @@ class MathMatrixInset : public MathParInset { public: /// - explicit MathMatrixInset(int m, int n, short st = LM_ST_TEXT); /// - explicit - MathMatrixInset(MathMatrixInset const &); - /// - ~MathMatrixInset(); - /// MathedInset * Clone(); /// void draw(Painter &, int, int); diff --git a/src/mathed/math_rowst.h b/src/mathed/math_rowst.h index 488967e4fa..ea6c16d037 100644 --- a/src/mathed/math_rowst.h +++ b/src/mathed/math_rowst.h @@ -116,6 +116,34 @@ struct MathedRowContainer { /// MathedRowContainer() : data_(0) {} + /// + MathedRowContainer(MathedRowContainer const & c) : data_(0) { + if (!c.empty()) { + MathedRowSt * ro = 0; + MathedRowSt * mrow = c.data_; + + while (mrow) { + MathedRowSt * r = new MathedRowSt(*mrow); + if (!ro) + data_ = r; + else + ro->next_ = r; + mrow = mrow->next_; + ro = r; + } + } + } + + + ~MathedRowContainer() { + MathedRowSt * r = data_; + while (r) { + MathedRowSt * q = r->next_; + delete r; + r = q; + } + } + /// iterator begin() { return iterator(this); } /// @@ -151,7 +179,6 @@ struct MathedRowContainer { private: // currently unimplemented just to make sure it's not used - MathedRowContainer(MathedRowContainer const &); // unimplemented void operator=(MathedRowContainer const &); // unimplemented }; -- 2.39.2