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 _QSNIPPET_H_ 00017 #define _QSNIPPET_H_ 00018 00019 #include "qce-config.h" 00020 00026 #include <QStringList> 00027 00028 class QEditor; 00029 class QSnippetManager; 00030 00031 #include "qsnippetpatternloader.h" 00032 00033 class QCE_EXPORT QSnippet 00034 { 00035 friend class QSnippetManager; 00036 00037 public: 00038 inline QSnippet(const QSnippetPatternLoader *pl) : m_patternLoader(pl) {} 00039 virtual ~QSnippet() {} 00040 00041 inline QString name() const { return m_name; } 00042 inline void setName(const QString& n) { m_name = n; } 00043 00044 inline QStringList contexts() const { return m_contexts; } 00045 inline void setContexts(const QStringList& l) { m_contexts = l; } 00046 00047 inline QString pattern() const 00048 { return m_pattern; } 00049 00050 inline void setPattern(const QString& p) 00051 { m_pattern = p; m_patternLoader->reloadSnippet(this, p); } 00052 00053 virtual void insert(QEditor *e) const = 0; 00054 00055 protected: 00056 QString m_name; 00057 QString m_pattern; 00058 QStringList m_contexts; 00059 const QSnippetPatternLoader *m_patternLoader; 00060 }; 00061 00062 #endif