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 QString indenter; 00051 bool hidden; 00052 }; 00053 00057 typedef QList<KateSyntaxModeListItem*> KateSyntaxModeList; 00058 00062 class KateSyntaxContextData 00063 { 00064 public: 00065 QDomElement parent; 00066 QDomElement currentGroup; 00067 QDomElement item; 00068 }; 00069 00073 class KateSyntaxDocument : public QDomDocument 00074 { 00075 public: 00081 explicit KateSyntaxDocument(KConfig *config, bool force = false); 00082 00086 ~KateSyntaxDocument(); 00087 00094 bool setIdentifier(const QString& identifier); 00095 00100 const KateSyntaxModeList &modeList() { return myModeList; } 00101 00107 bool nextGroup(KateSyntaxContextData* data); 00108 00114 bool nextItem(KateSyntaxContextData* data); 00115 00119 QString groupItemData(const KateSyntaxContextData* data,const QString& name); 00120 QString groupData(const KateSyntaxContextData* data,const QString& name); 00121 00122 void freeGroupInfo(KateSyntaxContextData* data); 00123 KateSyntaxContextData* getSubItems(KateSyntaxContextData* data); 00124 00129 KateSyntaxContextData* getConfig(const QString& mainGroupName, const QString &config); 00130 00135 KateSyntaxContextData* getGroupInfo(const QString& mainGroupName, const QString &group); 00136 00140 QStringList& finddata(const QString& mainGroup,const QString& type,bool clearList=true); 00141 00142 private: 00147 void setupModeList(bool force); 00148 00153 bool getElement (QDomElement &element, const QString &mainGroupName, const QString &config); 00154 00158 KateSyntaxModeList myModeList; 00159 00163 QString currentFile; 00164 00168 QStringList m_data; 00169 00173 KConfig *m_config; 00174 }; 00175 00176 #endif 00177 00178 // kate: space-indent on; indent-width 2; replace-tabs on;