* 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 <poenitz@htwm.de>
* array.[Ch]: factor out deep_copy,
}
-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);
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);
///
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); }
///
private:
// currently unimplemented just to make sure it's not used
- MathedRowContainer(MathedRowContainer const &); // unimplemented
void operator=(MathedRowContainer const &); // unimplemented
};