File indexing completed on 2025-02-23 04:35:31

0001 /*
0002     SPDX-FileCopyrightText: 2023 Mladen Milinkovic <max@smoothware.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef RICHDOM_H
0008 #define RICHDOM_H
0009 
0010 #include <QString>
0011 
0012 namespace SubtitleComposer {
0013 
0014 class RichDocument;
0015 
0016 class RichDOM
0017 {
0018 public:
0019     RichDOM();
0020     ~RichDOM();
0021 
0022     enum NodeType {
0023         Root,
0024         Bold,
0025         Italic,
0026         Underline,
0027         Strikethrough,
0028         Font,
0029         Class,
0030         Voice,
0031         Invalid = -1
0032     };
0033 
0034     struct Node {
0035         Node(NodeType type_=Invalid, const QString &klass_=QString(), const QString &id_=QString());
0036         ~Node();
0037 
0038         Node(const Node &other);
0039         Node & operator=(const Node &other);
0040 
0041         QString cssSel();
0042 
0043         void debugDump(QString pfx=QString());
0044 
0045         NodeType type;
0046         QString id;
0047         QString klass;
0048         quint32 nodeStart;
0049         quint32 nodeEnd;
0050         Node *next;
0051         Node *parent;
0052         Node *children;
0053     };
0054 
0055     void update(const RichDocument *doc);
0056 
0057 private:
0058     friend class RichDocument;
0059     Node *m_root;
0060 };
0061 
0062 }
0063 
0064 #endif // RICHDOM_H