QCodeEdit 2.2
|
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr> 00004 ** 00005 ** This file is part of the Edyuk project <http://edyuk.org> 00006 ** 00007 ** This file may be used under the terms of the GNU General Public License 00008 ** version 3 as published by the Free Software Foundation and appearing in the 00009 ** file GPL.txt included in the packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ****************************************************************************/ 00015 00016 #ifndef _QLANGUAGE_FACTORY_H_ 00017 #define _QLANGUAGE_FACTORY_H_ 00018 00030 #include "qce-config.h" 00031 00032 #include <QHash> 00033 #include <QObject> 00034 #include <QStringList> 00035 00036 class QEditor; 00037 class QFormatScheme; 00038 class QLanguageDefinition; 00039 class QCodeCompletionEngine; 00040 00041 class QCE_EXPORT QLanguageFactory : public QObject 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 struct LangData 00047 { 00048 QString lang, mime; 00049 QStringList extensions; 00050 00051 QFormatScheme *s; 00052 00053 QLanguageDefinition *d; 00054 QCodeCompletionEngine *e; 00055 }; 00056 00057 QLanguageFactory(QFormatScheme *fmt, QObject *p = 0); 00058 virtual ~QLanguageFactory(); 00059 00060 QStringList languages() const; 00061 QStringList fileFilters() const; 00062 00063 const LangData& languageData(const QString& lang); 00064 00065 void addDefinitionPath(const QString& path); 00066 00067 inline QFormatScheme* defaultFormatScheme() const { return m_defaultFormatScheme; } 00068 00069 public slots: 00070 void addLanguage(const LangData& d); 00071 void addLanguageDefinition(QLanguageDefinition *l); 00072 void addCompletionEngine(QCodeCompletionEngine *e); 00073 00074 virtual void setLanguage(QEditor *e, const QString& f); 00075 00076 private: 00077 QStringList m_languages; 00078 QHash<QString, LangData> m_data; 00079 QList<QCodeCompletionEngine*> m_unusedEngines; 00080 00081 QFormatScheme *m_defaultFormatScheme; 00082 }; 00083 00084 #endif // _QLANGUAGE_FACTORY_H_