]> sigrok.org Git - pulseview.git/blobdiff - pv/view/viewitemiterator.hpp
Fix #957 and #874 by implementing the pane splitter
[pulseview.git] / pv / view / viewitemiterator.hpp
index 179de383965218d2b31321b96b67686ab424f316..91ace4e90d9c710e84219572650d2f8e045f8ab8 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
-#define PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP
+#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP
 
 #include <algorithm>
 #include <cassert>
 
 #include <pv/session.hpp>
 
+using std::dynamic_pointer_cast;
+using std::forward_iterator_tag;
+using std::shared_ptr;
+using std::stack;
+
 namespace pv {
-namespace view {
+namespace views {
+namespace TraceView {
 
 template<class Owner, class Item> class ViewItemIterator
 {
 public:
-       typedef typename std::conditional<std::is_const<Owner>::value,
-               typename Owner::item_list::const_iterator,
-               typename Owner::item_list::iterator>::type child_iterator;
-
-       typedef std::shared_ptr<Item> value_type;
+       typedef typename Owner::item_list::const_iterator child_iterator;
+       typedef shared_ptr<Item> value_type;
        typedef ptrdiff_t difference_type;
        typedef value_type pointer;
-       typedef value_type& reference;
-       typedef std::forward_iterator_tag iterator_category;
+       typedef const value_type& reference;
+       typedef forward_iterator_tag iterator_category;
 
 public:
        ViewItemIterator(Owner *owner) :
@@ -71,9 +73,6 @@ public:
        }
 
        ViewItemIterator<Owner, Item>& operator++() {
-               using std::dynamic_pointer_cast;
-               using std::shared_ptr;
-
                assert(!owner_stack_.empty());
                assert(!iter_stack_.empty());
 
@@ -116,8 +115,8 @@ public:
        }
 
 private:
-       std::stack<Owner*> owner_stack_;
-       std::stack<child_iterator> iter_stack_;
+       stack<Owner*> owner_stack_;
+       stack<child_iterator> iter_stack_;
 };
 
 template<class Owner, class Item>
@@ -126,7 +125,8 @@ void swap(ViewItemIterator<Owner, Item>& a, ViewItemIterator<Owner, Item>& b)
        a.swap(b);
 }
 
-} // namespace view
+} // namespace TraceView
+} // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEW_VIEWITEMITERATOR_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMITERATOR_HPP