Disable stack execution on plugins
[claws.git] / src / plugins / litehtml_viewer / litehtml / iterators.h
blobb1a678d7b4901e3a092ca6a5bd05360ca5567647
1 #ifndef LH_ITERATORS_H
2 #define LH_ITERATORS_H
4 #include "types.h"
5 #include <list>
6 #include <functional>
8 namespace litehtml
10 class render_item;
12 class iterator_selector
14 public:
15 virtual bool select(const std::shared_ptr<render_item>& el) = 0;
17 protected:
18 ~iterator_selector() = default;
21 enum iterator_item_type
23 iterator_item_type_child,
24 iterator_item_type_start_parent,
25 iterator_item_type_end_parent
28 class elements_iterator
30 private:
31 iterator_selector* m_go_inside;
32 iterator_selector* m_select;
33 bool m_return_parent;
35 /**
36 * Checks if iterator should go inside the element
38 * @param el element to check
39 * @return true to go inside
41 bool go_inside(const std::shared_ptr<render_item>& el);
43 public:
44 elements_iterator(bool return_parents, iterator_selector* go_inside, iterator_selector* select);
45 ~elements_iterator() = default;
47 void process(const std::shared_ptr<render_item>& container, const std::function<void (std::shared_ptr<render_item>&, iterator_item_type)>& func);
49 private:
50 void next_idx();
53 class go_inside_inline final : public iterator_selector
55 public:
56 bool select(const std::shared_ptr<render_item>& el) override;
59 class inline_selector final : public iterator_selector
61 public:
62 bool select(const std::shared_ptr<render_item>& el) override;
65 class go_inside_table final : public iterator_selector
67 public:
68 bool select(const std::shared_ptr<render_item>& el) override;
71 class table_rows_selector final : public iterator_selector
73 public:
74 bool select(const std::shared_ptr<render_item>& el) override;
77 class table_cells_selector final : public iterator_selector
79 public:
80 bool select(const std::shared_ptr<render_item>& el) override;
84 #endif // LH_ITERATORS_H