[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters/kspread/excel/sidewinder
From:       Ariya Hidayat <ariya () kde ! org>
Date:       2005-03-31 19:54:15
Message-ID: 20050331195415.CF9EC684 () office ! kde ! org
[Download RAW message or body]

CVS commit by ariya: 

TODO-- // destroy all cells, columns, rows in destructor


  M +19 -1     sheet.cpp   1.11
  M +5 -0      sheet.h   1.11


--- koffice/filters/kspread/excel/sidewinder/sheet.h  #1.10:1.11
@@ -43,4 +43,9 @@ public:
   Workbook* workbook();
 
+  /*
+   * Clears the sheet, i.e. makes it as if it is just constructed.
+   */
+  void clear(); 
+  
   void setName( const UString& name );
 

--- koffice/filters/kspread/excel/sidewinder/sheet.cpp  #1.10:1.11
@@ -79,5 +79,5 @@ Sheet::Sheet( Workbook* wb )
 Sheet::~Sheet()
 {
-  // TODO delete all cells, columns, rows
+  clear();
   delete d;
 }
@@ -88,4 +88,22 @@ Workbook* Sheet::workbook()
 }
 
+void Sheet::clear()
+{
+  // delete all cells
+  std::map<unsigned,Cell*>::iterator cell_it;
+  for( cell_it = d->cells.begin(); cell_it != d->cells.end(); ++cell_it )
+    delete cell_it->second;
+  
+  // delete all columns
+  std::map<unsigned,Column*>::iterator col_it;
+  for( col_it = d->columns.begin(); col_it != d->columns.end(); ++col_it )
+    delete col_it->second;
+  
+  // delete all rows
+  std::map<unsigned,Row*>::iterator row_it;
+  for( row_it = d->rows.begin(); row_it != d->rows.end(); ++row_it )
+    delete row_it->second;
+}
+
 UString Sheet::name() const
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic