File indexing completed on 2024-04-21 05:51:36

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 
0007 #ifndef COMPOUNDREGEXP_H
0008 #define COMPOUNDREGEXP_H
0009 
0010 #include "regexp.h"
0011 
0012 /**
0013    Abstract syntax node for `compound content' regular expression
0014    @internal
0015 */
0016 class CompoundRegExp : public RegExp
0017 {
0018 public:
0019     explicit CompoundRegExp(bool selected,
0020                             const QString &title = QString(),
0021                             const QString &description = QString(),
0022                             bool hidden = false,
0023                             bool allowReplace = false,
0024                             RegExp *child = nullptr);
0025 
0026     bool check(ErrorMap &, bool first, bool last) override;
0027     int precedence() const override
0028     {
0029         return _child->precedence();
0030     }
0031 
0032     QDomNode toXml(QDomDocument *doc) const override;
0033     bool load(const QDomElement &, const QString &version) override;
0034     QString title() const
0035     {
0036         return _title;
0037     }
0038 
0039     QString description() const
0040     {
0041         return _description;
0042     }
0043 
0044     RegExp *child() const
0045     {
0046         return _child;
0047     }
0048 
0049     bool hidden() const
0050     {
0051         return _hidden;
0052     }
0053 
0054     bool allowReplace() const
0055     {
0056         return _allowReplace;
0057     }
0058 
0059     RegExpType type() const override
0060     {
0061         return COMPOUND;
0062     }
0063 
0064     bool operator==(const RegExp &other) const override;
0065 
0066 private:
0067     QString _title;
0068     QString _description;
0069     bool _hidden;
0070     bool _allowReplace;
0071     RegExp *_child = nullptr;
0072 };
0073 
0074 #endif // COMPOUNDREGEXP_H