Kate
katesyntaxdocument.h
Go to the documentation of this file.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 <QtCore/QList> 00024 #include <QtCore/QStringList> 00025 #include <QtXml/QDomDocument> 00026 00027 class KConfig; 00028 00034 class KateSyntaxModeListItem 00035 { 00036 public: 00037 QString name; 00038 QString nameTranslated; 00039 QString section; 00040 QString mimetype; 00041 QString extension; 00042 QString identifier; 00043 QString version; 00044 QString priority; 00047 QString style; 00048 QString author; 00049 QString license; 00050 bool hidden; 00051 }; 00052 00056 typedef QList<KateSyntaxModeListItem*> KateSyntaxModeList; 00057 00061 class KateSyntaxContextData 00062 { 00063 public: 00064 QDomElement parent; 00065 QDomElement currentGroup; 00066 QDomElement item; 00067 }; 00068 00072 class KateSyntaxDocument : public QDomDocument 00073 { 00074 public: 00080 explicit KateSyntaxDocument(KConfig *config, bool force = false); 00081 00085 ~KateSyntaxDocument(); 00086 00093 bool setIdentifier(const QString& identifier); 00094 00099 const KateSyntaxModeList &modeList() { return myModeList; } 00100 00106 bool nextGroup(KateSyntaxContextData* data); 00107 00113 bool nextItem(KateSyntaxContextData* data); 00114 00118 QString groupItemData(const KateSyntaxContextData* data,const QString& name); 00119 QString groupData(const KateSyntaxContextData* data,const QString& name); 00120 00121 void freeGroupInfo(KateSyntaxContextData* data); 00122 KateSyntaxContextData* getSubItems(KateSyntaxContextData* data); 00123 00128 KateSyntaxContextData* getConfig(const QString& mainGroupName, const QString &config); 00129 00134 KateSyntaxContextData* getGroupInfo(const QString& mainGroupName, const QString &group); 00135 00139 QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true); 00140 00141 private: 00146 void setupModeList(bool force); 00147 00152 bool getElement (QDomElement &element, const QString &mainGroupName, const QString &config); 00153 00157 KateSyntaxModeList myModeList; 00158 00162 QString currentFile; 00163 00167 QStringList m_data; 00168 00172 KConfig *m_config; 00173 }; 00174 00175 #endif 00176 00177 // kate: space-indent on; indent-width 2; replace-tabs on;