katesyntaxdocument.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
00003    Copyright (C) 2000 Scott Manson <sdmanson@alltel.net>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __KATE_SYNTAXDOCUMENT_H__
00021 #define __KATE_SYNTAXDOCUMENT_H__
00022 
00023 #include <qdom.h>
00024 #include <qstringlist.h>
00025 
00029 class KateSyntaxModeListItem
00030 {
00031   public:
00032     QString name;
00033     QString nameTranslated;
00034     QString section;
00035     QString mimetype;
00036     QString extension;
00037     QString identifier;
00038     QString version;
00039     QString priority;
00040     QString author;
00041     QString license;
00042     bool hidden;
00043 };
00044 
00048 typedef QValueList<KateSyntaxModeListItem*> KateSyntaxModeList;
00049 
00053 class KateSyntaxContextData
00054 {
00055   public:
00056     QDomElement parent;
00057     QDomElement currentGroup;
00058     QDomElement item;
00059 };
00060 
00064 class KateSyntaxDocument : public QDomDocument
00065 {
00066   public:
00072     KateSyntaxDocument(bool force = false);
00073 
00077     ~KateSyntaxDocument();
00078 
00085     bool setIdentifier(const QString& identifier);
00086 
00091     const KateSyntaxModeList &modeList() { return myModeList; }
00092 
00098     bool nextGroup(KateSyntaxContextData* data);
00099 
00105     bool nextItem(KateSyntaxContextData* data);
00106 
00110     QString groupItemData(const KateSyntaxContextData* data,const QString& name);
00111     QString groupData(const KateSyntaxContextData* data,const QString& name);
00112 
00113     void freeGroupInfo(KateSyntaxContextData* data);
00114     KateSyntaxContextData* getSubItems(KateSyntaxContextData* data);
00115 
00120     KateSyntaxContextData* getConfig(const QString& mainGroupName, const QString &config);
00121 
00126     KateSyntaxContextData* getGroupInfo(const QString& mainGroupName, const QString &group);
00127 
00131     QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true);
00132 
00133   private:
00138     void setupModeList(bool force);
00139 
00144     bool getElement (QDomElement &element, const QString &mainGroupName, const QString &config);
00145 
00149     KateSyntaxModeList myModeList;
00150 
00154     QString currentFile;
00155 
00159     QStringList m_data;
00160 };
00161 
00162 #endif
00163 
00164 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE Home | KDE Accessibility Home | Description of Access Keys