Remove handcrafted copy constructor and destructor for MathMatrixInset. Andre' -- André Pönitz ........................................ [EMAIL PROTECTED]
Index: ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v retrieving revision 1.58 diff -u -p -r1.58 ChangeLog --- ChangeLog 2001/03/08 11:51:35 1.58 +++ ChangeLog 2001/03/08 15:51:22 @@ -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 <[EMAIL PROTECTED]> * array.[Ch]: factor out deep_copy, Index: math_matrixinset.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_matrixinset.C,v retrieving revision 1.14 diff -u -p -r1.14 math_matrixinset.C --- math_matrixinset.C 2001/03/08 13:38:20 1.14 +++ math_matrixinset.C 2001/03/08 15:51:23 @@ -35,47 +35,6 @@ MathMatrixInset::MathMatrixInset(int m, } -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); Index: math_matrixinset.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_matrixinset.h,v retrieving revision 1.8 diff -u -p -r1.8 math_matrixinset.h --- math_matrixinset.h 2001/03/08 13:38:20 1.8 +++ math_matrixinset.h 2001/03/08 15:51:23 @@ -18,13 +18,7 @@ class MathMatrixInset : public MathParInset { public: /// - explicit MathMatrixInset(int m, int n, short st = LM_ST_TEXT); - /// - explicit - MathMatrixInset(MathMatrixInset const &); - /// - ~MathMatrixInset(); /// MathedInset * Clone(); /// Index: math_rowst.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_rowst.h,v retrieving revision 1.7 diff -u -p -r1.7 math_rowst.h --- math_rowst.h 2001/03/08 13:38:20 1.7 +++ math_rowst.h 2001/03/08 15:51:23 @@ -117,6 +117,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); } /// bool empty() const { return data_ == 0; } @@ -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 };