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

List:       kde-commits
Subject:    kdelibs/kate/part
From:       Christoph Cullmann <crossfire () babylon2k ! de>
Date:       2004-08-25 20:39:16
Message-ID: 20040825203916.F3861253E () office ! kde ! org
[Download RAW message or body]

CVS commit by cullmann: 

cu ptrlist here


  M +17 -31    katehighlight.cpp   1.177


--- kdelibs/kate/part/katehighlight.cpp  #1.176:1.177
@@ -97,5 +97,5 @@ class KateHlItem
     static void dynamicSubstitute(QString& str, const QStringList *args);
 
-    QPtrList<KateHlItem> *subItems;
+    QMemArray<KateHlItem*> subItems;
     int attr;
     int ctx;
@@ -369,6 +369,5 @@ static KateHlItemData::ItemStyles getDef
 //BEGIN KateHlItem
 KateHlItem::KateHlItem(int attribute, int context,signed char regionId,signed char \
                regionId2)
-  : subItems(0),
-    attr(attribute),
+  : attr(attribute),
     ctx(context),
     region(regionId),
@@ -383,10 +382,6 @@ KateHlItem::~KateHlItem()
 {
   //kdDebug(13010)<<"In hlItem::~KateHlItem()"<<endl;
-  if (subItems!=0)
-  {
-    subItems->setAutoDelete(true);
-    subItems->clear();
-    delete subItems;
-  }
+  for (uint i=0; i < subItems.size(); i++)
+    delete subItems[i];
 }
 
@@ -629,12 +624,9 @@ int KateHlInt::checkHgl(const QString& t
   if (offset2 > offset)
   {
-    if (subItems)
-    {
-      for (KateHlItem *it = subItems->first(); it; it = subItems->next())
+    for (uint i=0; i < subItems.size(); i++)
       {
-        if ( (offset = it->checkHgl(text, offset2, len)) )
+      if ( (offset = subItems[i]->checkHgl(text, offset2, len)) )
           return offset;
       }
-    }
 
     return offset2;
@@ -695,14 +687,11 @@ int KateHlFloat::checkHgl(const QString&
     else
     {
-      if (subItems)
-      {
-        for (KateHlItem *it = subItems->first(); it; it = subItems->next())
+      for (uint i=0; i < subItems.size(); i++)
         {
-          int offset2 = it->checkHgl(text, offset, len);
+        int offset2 = subItems[i]->checkHgl(text, offset, len);
 
           if (offset2)
             return offset2;
         }
-      }
 
       return offset;
@@ -727,14 +716,11 @@ int KateHlFloat::checkHgl(const QString&
   if (b)
   {
-    if (subItems)
-    {
-      for (KateHlItem *it = subItems->first(); it; it = subItems->next())
+    for (uint i=0; i < subItems.size(); i++)
       {
-        int offset2 = it->checkHgl(text, offset, len);
+      int offset2 = subItems[i]->checkHgl(text, offset, len);
 
         if (offset2)
           return offset2;
       }
-    }
 
     return offset;
@@ -2647,8 +2633,8 @@ int KateHighlighting::addToContextList(c
         if (tmpbool=KateHlManager::self()->syntax->nextItem(datasub))
         {
-          c->subItems=new QPtrList<KateHlItem>;
           for (;tmpbool;tmpbool=KateHlManager::self()->syntax->nextItem(datasub))
           {
-            c->subItems->append(createKateHlItem(datasub,iDl,&RegionList,&ContextNameList));
 +            c->subItems.resize (c->subItems.size()+1);
+            c->subItems[c->subItems.size()-1] = \
createKateHlItem(datasub,iDl,&RegionList,&ContextNameList);  }                        \
}  KateHlManager::self()->syntax->freeGroupInfo(datasub);


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

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