File indexing completed on 2024-04-28 16:44:53

0001 #ifndef CONDITIONS_LIST_BASE_H
0002 #define CONDITIONS_LIST_BASE_H
0003 /* SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz>
0004    SPDX-FileCopyrightText: 1999-2001 Lubos Lunak <l.lunak@kde.org>
0005 
0006    SPDX-License-Identifier: LGPL-2.0-only
0007 */
0008 
0009 #include "conditions/condition.h"
0010 
0011 #include <QList>
0012 
0013 class KConfigGroup;
0014 
0015 namespace KHotKeys
0016 {
0017 class ConditionsVisitor;
0018 
0019 /**
0020  * @author Michael Jansen <kde@michael-jansen.biz>
0021  */
0022 class Q_DECL_EXPORT Condition_list_base : public Condition, private QList<Condition *>
0023 {
0024     typedef Condition base;
0025 
0026 public:
0027     Condition_list_base(Condition_list_base *parent = nullptr);
0028 
0029     Condition_list_base(const QList<Condition *> &children_P, Condition_list_base *parent_P);
0030 
0031     Condition_list_base(KConfigGroup &cfg_P, Condition_list_base *parent_P);
0032 
0033     ~Condition_list_base() override;
0034 
0035     void cfg_write(KConfigGroup &cfg_P) const override;
0036     virtual bool accepts_children() const;
0037 
0038     typedef QList<Condition *>::iterator Iterator;
0039     typedef QList<Condition *>::const_iterator ConstIterator;
0040 
0041     void append(Condition *);
0042 
0043     Iterator begin();
0044     ConstIterator begin() const;
0045 
0046     Iterator end();
0047     ConstIterator end() const;
0048 
0049     Condition *first();
0050     Condition const *first() const;
0051 
0052     int count() const;
0053 
0054     bool isEmpty() const;
0055 
0056     void clear();
0057 
0058     void visit(ConditionsVisitor *visitor) override;
0059 
0060 protected:
0061     int removeAll(Condition *const &);
0062 
0063     friend class Condition;
0064 };
0065 
0066 } // namespace KHotKeys
0067 
0068 #endif /* #ifndef CONDITIONS_LIST_BASE_H */