Commits

Anonymous committed 8e08444

itemsets: refactored to a static function in anonymous namespace for readability

Comments (0)

Files changed (1)

svtools/source/items1/itemset.cxx

         }
         o_rResult.push_back(0);
     }
+
+    static void lcl_FindRange(
+        vector<sal_uInt16>::const_iterator pRange,
+        const ItemVector::iterator pStartSearchRange, const ItemVector::iterator pEndSearchRange,
+        ItemVector::iterator& o_pStart, ItemVector::iterator& o_pEnd)
+    {
+        o_pStart = lower_bound(pStartSearchRange, pEndSearchRange, ItemEntry(*pRange));
+        o_pEnd = upper_bound(o_pStart, pEndSearchRange, ItemEntry(*(pRange+1)));
+    }
 }
 
 namespace sfx { namespace item {
             lcl_IntersectWhichRanges(vOldLegalWhichRange, pCurrentSet->m_vWhichRanges, vLegalWhichRange);
             if(vLegalWhichRange.size() < 3)
                 break;
-            ItemVector::iterator pLastRangeStart = lower_bound(
-                    pCurrentSet->m_pItems->begin(),
-                    pCurrentSet->m_pItems->end(),
-                    ItemEntry(vLegalWhichRange[0]));
-            ItemVector::iterator pLastRangeEnd = upper_bound(
-                    pLastRangeStart,
-                    pCurrentSet->m_pItems->end(),
-                    ItemEntry(vLegalWhichRange[1]));
+            ItemVector::iterator pLastRangeStart, pLastRangeEnd;
+            lcl_FindRange(
+                vLegalWhichRange.begin(),
+                pCurrentSet->m_pItems->begin(), pCurrentSet->m_pItems->end(),
+                pLastRangeStart, pLastRangeEnd);
             for(vector<sal_uInt16>::const_iterator pCurrentRange = vLegalWhichRange.begin()+2;
                 *pCurrentRange && pLastRangeEnd != pCurrentSet->m_pItems->end();
                 pCurrentRange += 2)
             {
-                ItemVector::iterator pStart = lower_bound(
-                    pLastRangeEnd,
-                    pCurrentSet->m_pItems->end(),
-                    ItemEntry(*pCurrentRange));
-                ItemVector::iterator pEnd = upper_bound(
-                    pStart,
-                    pCurrentSet->m_pItems->end(),
-                    ItemEntry(*(pCurrentRange+1)));
+                ItemVector::iterator pStart, pEnd;
+                lcl_FindRange(
+                    pCurrentRange,
+                    pLastRangeEnd, pCurrentSet->m_pItems->end(),
+                    pStart, pEnd);
                 if(pStart != pLastRangeEnd)
                 {
                     swap(pSourceItems, pOldSourceItems);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.