File indexing completed on 2024-05-19 08:29:15
0001 /* 0002 SPDX-FileCopyrightText: 2006-2007 Alexander Dymo <adymo@kdevelop.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_SUBLIMEAREAWALKERS_H 0008 #define KDEVPLATFORM_SUBLIMEAREAWALKERS_H 0009 0010 #include <QList> 0011 0012 0013 namespace Sublime { 0014 0015 //area walkers implementations 0016 0017 template <typename Operator> 0018 Area::WalkerMode Area::walkViewsInternal(Operator &op, AreaIndex *index) 0019 { 0020 Area::WalkerMode mode = op(index); 0021 if (mode == Area::StopWalker) 0022 return mode; 0023 else if (index->first() && index->second()) 0024 { 0025 mode = walkViewsInternal(op, index->first()); 0026 if (mode == Area::StopWalker) 0027 return mode; 0028 mode = walkViewsInternal(op, index->second()); 0029 } 0030 return mode; 0031 } 0032 0033 template <typename Operator> 0034 void Area::walkViews(Operator &op, AreaIndex *index) 0035 { 0036 walkViewsInternal(op, index); 0037 } 0038 0039 template <typename Operator> 0040 void Area::walkToolViews(Operator &op, Positions positions) 0041 { 0042 const QList<View*> currViews = toolViews(); 0043 for (View* view : currViews) { 0044 Sublime::Position position = toolViewPosition(view); 0045 if (position & positions) 0046 if (op(view, position) == Area::StopWalker) 0047 break; 0048 } 0049 } 0050 0051 } 0052 0053 #endif 0054