1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr> 4 ** 5 ** This file is part of the Edyuk project <http://edyuk.org> 6 ** 7 ** This file may be used under the terms of the GNU General Public License 8 ** version 3 as published by the Free Software Foundation and appearing in the 9 ** file GPL.txt included in the packaging of this file. 10 ** 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 ** 14 ****************************************************************************/ 15 16 #ifndef _QSNIPPET_H_ 17 #define _QSNIPPET_H_ 18 19 #include "qce-config.h" 20 21 /*! 22 \file qsnippet.h 23 \brief Definition of the QSnippet class 24 */ 25 26 #include <QStringList> 27 28 class QEditor; 29 class QSnippetManager; 30 31 #include "qsnippetpatternloader.h" 32 33 class QCE_EXPORT QSnippet 34 { 35 friend class QSnippetManager; 36 37 public: QSnippet(const QSnippetPatternLoader * pl)38 inline QSnippet(const QSnippetPatternLoader *pl) : m_patternLoader(pl) {} ~QSnippet()39 virtual ~QSnippet() {} 40 name()41 inline QString name() const { return m_name; } setName(const QString & n)42 inline void setName(const QString& n) { m_name = n; } 43 contexts()44 inline QStringList contexts() const { return m_contexts; } setContexts(const QStringList & l)45 inline void setContexts(const QStringList& l) { m_contexts = l; } 46 pattern()47 inline QString pattern() const 48 { return m_pattern; } 49 setPattern(const QString & p)50 inline void setPattern(const QString& p) 51 { m_pattern = p; m_patternLoader->reloadSnippet(this, p); } 52 53 virtual void insert(QEditor *e) const = 0; 54 55 protected: 56 QString m_name; 57 QString m_pattern; 58 QStringList m_contexts; 59 const QSnippetPatternLoader *m_patternLoader; 60 }; 61 62 #endif 63