summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katesyntaxdocument.h
blob: 072f5f00534238a1279405deab35cf94d09df9c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/***************************************************************************
                          katesyntaxdocument.h  -  description
                             -------------------
    begin                : Sat 31 March 2001
    copyright            : (C) 2001,2002 by Joseph Wenninger
    email                : jowenn@kde.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SYNTAXDOCUMENT_H
#define SYNTAXDOCUMENT_H

#include <opie2/xmltree.h>
#include <qlist.h>
#include <qstringlist.h>


class syntaxModeListItem
{
  public:
    QString name;
    QString section;
    QString mimetype;
    QString extension;
    QString identifier;
};

class syntaxContextData
{
  public:
    Opie::Core::XMLElement *parent;
    Opie::Core::XMLElement *currentGroup;
    Opie::Core::XMLElement *item;
};

typedef QList<syntaxModeListItem> SyntaxModeList;

class SyntaxDocument
{
  public:
    SyntaxDocument();
    ~SyntaxDocument();

    QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true);
    SyntaxModeList modeList();

    syntaxContextData* getGroupInfo(const QString& langName, const QString &group);
    void freeGroupInfo(syntaxContextData* data);
    syntaxContextData* getConfig(const QString& mainGroupName, const QString &Config);
    bool nextItem(syntaxContextData* data);
    bool nextGroup(syntaxContextData* data);
    syntaxContextData* getSubItems(syntaxContextData* data);
    QString groupItemData(syntaxContextData* data,QString name);
    QString groupData(syntaxContextData* data,QString name);
    void setIdentifier(const QString& identifier);

  private:
     Opie::Core::XMLElement *m_root;
     void setupModeList(bool force=false);
     QString currentFile;
    SyntaxModeList myModeList;
    QStringList m_data;
};

#endif