]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/fl/garbagec.cpp
regenerated all makefiles with bakefile 0.2.0; removed REZ option from config.bkl...
[wxWidgets.git] / contrib / src / fl / garbagec.cpp
index 564823928bb467c906eed98d78b78e6521597d9d..e103208ccb0c1a88901192980961c472b1aff7dd 100644 (file)
@@ -9,11 +9,6 @@
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
-#ifdef __GNUG__
-    #pragma implementation "garbagec.h"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
@@ -32,7 +27,7 @@
 
 inline static GCItem& node_to_item( wxNode* pNode )
 {
-    return *( (GCItem*)(pNode->Data()) );
+    return *( (GCItem*)(pNode->GetData()) );
 }
 
 GarbageCollector::~GarbageCollector()
@@ -44,13 +39,13 @@ GarbageCollector::~GarbageCollector()
 
 void GarbageCollector::DestroyItemList( wxList& lst )
 {
-    wxNode* pNode = lst.First();
+    wxNode* pNode = lst.GetFirst();
 
     while( pNode )
     {
         delete &node_to_item( pNode );
 
-        pNode = pNode->Next();
+        pNode = pNode->GetNext();
     }
 
     lst.Clear();
@@ -58,7 +53,7 @@ void GarbageCollector::DestroyItemList( wxList& lst )
 
 wxNode* GarbageCollector::FindItemNode( void* pForObj )
 {
-    wxNode* pNode = mAllNodes.First();
+    wxNode* pNode = mAllNodes.GetFirst();
 
     while( pNode )
     {
@@ -66,26 +61,23 @@ wxNode* GarbageCollector::FindItemNode( void* pForObj )
 
             return pNode;
 
-        pNode = pNode->Next();
+        pNode = pNode->GetNext();
     }
 
-    int avoidCompilerWarning = 0;
-    wxASSERT(avoidCompilerWarning); // DBG:: item should be present
-
-    return 0;
+    return NULL;
 }
 
 wxNode* GarbageCollector::FindReferenceFreeItemNode()
 {
-    wxNode* pNode = mAllNodes.First();
+    wxNode* pNode = mAllNodes.GetFirst();
 
     while( pNode )
     {
-        if ( node_to_item( pNode ).mRefs.Number() == 0 ) 
+        if ( node_to_item( pNode ).mRefs.GetCount() == 0 ) 
 
             return pNode;
 
-        pNode = pNode->Next();
+        pNode = pNode->GetNext();
     }
 
     return 0;
@@ -93,18 +85,18 @@ wxNode* GarbageCollector::FindReferenceFreeItemNode()
 
 void GarbageCollector::RemoveReferencesToNode( wxNode* pItemNode )
 {
-    wxNode* pNode = mAllNodes.First();
+    wxNode* pNode = mAllNodes.GetFirst();
 
     while( pNode )
     {
         wxList& refLst   = node_to_item( pNode ).mRefs;
-        wxNode* pRefNode = refLst.First();
+        wxNode* pRefNode = refLst.GetFirst();
 
         while( pRefNode )
         {
-            if ( pRefNode->Data() == (wxObject*)pItemNode )
+            if ( pRefNode->GetData() == (wxObject*)pItemNode )
             {
-                wxNode* pNext = pRefNode->Next();
+                wxNode* pNext = pRefNode->GetNext();
 
                 refLst.DeleteNode( pRefNode );
 
@@ -112,35 +104,35 @@ void GarbageCollector::RemoveReferencesToNode( wxNode* pItemNode )
 
                 continue;
             }
-            else pRefNode = pRefNode->Next();
+            else pRefNode = pRefNode->GetNext();
         }
 
-        pNode = pNode->Next();
+        pNode = pNode->GetNext();
     }
 }
 
 void GarbageCollector::ResolveReferences()
 {
-    wxNode* pNode = mAllNodes.First();
+    wxNode* pNode = mAllNodes.GetFirst();
 
     while( pNode )
     {
         GCItem& item = node_to_item( pNode );
 
-        wxNode* pRefNode = item.mRefs.First();
+        wxNode* pRefNode = item.mRefs.GetFirst();
 
         while( pRefNode )
         {
-            pRefNode->SetData( (wxObject*) FindItemNode( (void*)pRefNode->Data() ) );
+            pRefNode->SetData( (wxObject*) FindItemNode( (void*)pRefNode->GetData() ) );
 
-            pRefNode = pRefNode->Next();
+            pRefNode = pRefNode->GetNext();
         }
 
-        pNode = pNode->Next();
+        pNode = pNode->GetNext();
     }
 }
 
-void GarbageCollector::AddObject( void* pObj, int refCnt )
+void GarbageCollector::AddObject( void* pObj, int WXUNUSED(refCnt) )
 {
     // FOR NOW:: initial ref-count is not used
 
@@ -173,7 +165,7 @@ void GarbageCollector::ArrangeCollection()
             // append it to the list, where items are contained
             // in the increasing order of dependencies
 
-            mRegularLst.Append( pItemNode->Data() );
+            mRegularLst.Append( pItemNode->GetData() );
 
             mAllNodes.DeleteNode( pItemNode );
 
@@ -187,15 +179,16 @@ void GarbageCollector::ArrangeCollection()
             // otherwise, what is left - all nodes, which
             // are involved into cycled chains (rings)
 
-            wxNode* pNode = mAllNodes.First();
+            wxNode* pNode = mAllNodes.GetFirst();
 
             while( pNode )
             {
-                mCycledLst.Append( pNode->Data() );
+                mCycledLst.Append( pNode->GetData() );
 
-                pNode = pNode->Next();
+                pNode = pNode->GetNext();
             }
 
+            mAllNodes.Clear();
             break;
         }
 
@@ -217,8 +210,7 @@ wxList& GarbageCollector::GetCycledObjects()
 void GarbageCollector::Reset()
 {
     DestroyItemList( mAllNodes   );
-
-    mRegularLst.Clear();
-    mCycledLst.Clear();
+    DestroyItemList( mRegularLst );
+    DestroyItemList( mCycledLst );
 }