File indexing completed on 2024-04-14 05:44:26

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 __textregexp_h
0008 #define __textregexp_h
0009 
0010 #include "regexp.h"
0011 
0012 /**
0013    Abstract syntax node for `text' regular expression
0014    @internal
0015 */
0016 class TextRegExp : public RegExp
0017 {
0018 public:
0019     explicit TextRegExp(bool selected, const QString &text = QString());
0020 
0021     bool check(ErrorMap &, bool first, bool last) override;
0022     int precedence() const override
0023     {
0024         if (_text.length() > 1) {
0025             return 2;
0026         } else {
0027             return 4;
0028         }
0029     }
0030 
0031     QString text() const
0032     {
0033         return _text;
0034     }
0035 
0036     QDomNode toXml(QDomDocument *doc) const override;
0037     bool load(const QDomElement &, const QString &version) override;
0038     void append(const QString &str);
0039     RegExpType type() const override
0040     {
0041         return TEXT;
0042     }
0043 
0044     bool operator==(const RegExp &other) const override;
0045 
0046 private:
0047     QString _text;
0048 };
0049 
0050 #endif // __textregexp_h