[Kst] branches/work/kst/portto4/kst/src/libkst

Mike Fenton mike at staikos.net
Wed Nov 5 18:29:44 CET 2008


SVN commit 880496 by fenton:

Add reset of NamedObject incrementors to ObjectStore clear.


 M  +28 -0     namedobject.cpp  
 M  +3 -0      namedobject.h  
 M  +3 -0      objectstore.cpp  


--- branches/work/kst/portto4/kst/src/libkst/namedobject.cpp #880495:880496
@@ -152,6 +152,34 @@
     _mnum = R.toString().toInt();
 }
 
+
+// Reset all name indexes.  Should only be used by ObjectStore when clearing the store entirely.
+void NamedObject::resetNameIndex() {
+  _vnum = 1; // vectors
+  _pnum = 1; // plugins
+  _csdnum = 1; // csd
+  _cnum = 1; // curves
+  _enum = 1; // equations
+  _hnum = 1; // histograms
+  _inum = 1; // images
+  _psdnum = 1; // psd
+  _xnum = 1; // scalars
+  _tnum = 1; // text string
+  _mnum = 1; // matrix
+
+  max_vnum = 0; // vectors
+  max_pnum = 0; // plugins
+  max_csdnum = 0; // csd
+  max_cnum = 0; // curves
+  max_enum = 0; // equations
+  max_hnum = 0; // histograms
+  max_inum = 0; // images
+  max_psdnum = 0; // psd
+  max_xnum = 0; // scalars
+  max_tnum = 0; // text string
+  max_mnum = 0; // matrix
+}
+
 // QString NamedObject::descriptionTip() const {
 //   return Name();
 // }
--- branches/work/kst/portto4/kst/src/libkst/namedobject.h #880495:880496
@@ -79,6 +79,9 @@
     bool descriptiveNameIsManual() const;
     static void processShortNameIndexAttributes(QXmlStreamAttributes &attrs);
 
+    // Reset all name indexes.  Should only be used by ObjectStore when clearing the store entirely.
+    static void resetNameIndex();
+
   protected:
     virtual QString _automaticDescriptiveName() const= 0;
     QString _manualDescriptiveName;
--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #880495:880496
@@ -128,6 +128,9 @@
   foreach(Object *o, _list) {
     removeObject(o);
   }
+
+  // Reset the named objects id's.
+  NamedObject::resetNameIndex();
 }
 
 


More information about the Kst mailing list