QCodeEdit  2.2
qsnippetmanager.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_MANAGER_H_
17 #define _QSNIPPET_MANAGER_H_
18 
19 #include "qce-config.h"
20 
26 #include <QStringList>
27 
28 class QSnippet;
30 
32 {
33  Q_OBJECT
34 
35  public:
36  QSnippetManager(QObject *p = 0);
37  virtual ~QSnippetManager();
38 
39  int snippetCount() const;
40  QSnippet* snippet(int i) const;
41  void removeSnippet(int i, bool cleanup = true);
42 
43  bool loadSnippetFromFile(const QString& file, const QString& type = QString());
44  bool loadSnippetFromString(const QString& name, const QString& pattern, const QString& type = QString());
45 
46  void saveSnippetsToDirectory(const QString& path);
47  void loadSnippetsFromDirectory(const QString& path);
48 
49  public slots:
50  void addSnippet(QSnippet *s);
51  void removeSnippet(QSnippet *s);
52 
53  void addPatternLoader(QSnippetPatternLoader *pl);
54  void removePatternLoader(QSnippetPatternLoader *pl);
55 
56  signals:
57  void snippetAdded(QSnippet *s);
58 
59  void snippetRemoved(int i);
60  void snippetRemoved(QSnippet *s);
61 
62  private:
63  QString typeGuess(const QString& pattern) const;
64  QSnippetPatternLoader* patternLoader(const QString& type) const;
65 
66  QList<QSnippet*> m_snippets;
67  QList<QSnippetPatternLoader*> m_patternLoaders;
68 };
69 
70 #endif // !_SNIPPETS_H_
#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
The base class for snippets.
Definition: qsnippet.h:33