QCodeEdit  2.2
qsnippet.h
Go to the documentation of this file.
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 
26 #include <QStringList>
27 
28 class QEditor;
29 class QSnippetManager;
30 
31 #include "qsnippetpatternloader.h"
32 
34 {
35  friend class QSnippetManager;
36 
37  public:
38  inline QSnippet(const QSnippetPatternLoader *pl) : m_patternLoader(pl) {}
39  virtual ~QSnippet() {}
40 
41  inline QString name() const { return m_name; }
42  inline void setName(const QString& n) { m_name = n; }
43 
44  inline QStringList contexts() const { return m_contexts; }
45  inline void setContexts(const QStringList& l) { m_contexts = l; }
46 
47  inline QString pattern() const
48  { return m_pattern; }
49 
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
#define QCE_EXPORT
Macro needed for cross-platform shared libraries creation.
Definition: qce-config.h:40
Utility file for shared library creation.
The base class for snippet loaders.
Definition: qsnippetpatternloader.h:28
A class managing code snippets.
Definition: qsnippetmanager.h:31
A text editing widget.
Definition: qeditor.h:55
The base class for snippets.
Definition: qsnippet.h:33
Definition of the QSnippetPatternLoader class.