File indexing completed on 2024-04-21 09:42:39

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 widgetfactory
0008 #define widgetfactory
0009 
0010 #include <QDomElement>
0011 
0012 class RegExpWidget;
0013 class RegExpEditorWindow;
0014 class QWidget;
0015 class RegExp;
0016 
0017 /**
0018    All the different regular expression types.
0019 */
0020 enum RegExpType {
0021     TEXT = 0,
0022     CHARSET = 1,
0023     DOT = 2,
0024     REPEAT = 3,
0025     ALTN = 4,
0026     COMPOUND = 5,
0027     BEGLINE = 6,
0028     ENDLINE = 7,
0029     WORDBOUNDARY = 8,
0030     NONWORDBOUNDARY = 9,
0031     CONC = 10,
0032     DRAGACCEPTER = 11,
0033     POSLOOKAHEAD = 12,
0034     NEGLOOKAHEAD = 13
0035 };
0036 
0037 /**
0038    Class used to encapsulate information about widgets.
0039 
0040    When reading widgets from a stream, it is necessary to know about all
0041    sub-widgets to the @ref RegExpWidget class. This class exists to make
0042    sure that such general information is only kept once.
0043 
0044    @internal
0045 */
0046 class WidgetFactory
0047 {
0048 public:
0049     static RegExpWidget *createWidget(RegExpEditorWindow *editorWindow, QWidget *parent, RegExpType type);
0050     static RegExpWidget *createWidget(RegExp *regexp, RegExpEditorWindow *editorWindow, QWidget *parent);
0051     static RegExp *createRegExp(const QDomElement &node, const QString &version);
0052     static RegExp *createRegExp(const QString &str);
0053     static bool isContainer(RegExpType);
0054 };
0055 
0056 #endif // widgetfactory