• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • snippet
snippetstore.h
Go to the documentation of this file.
1 /* This file is part of the Kate project.
2  * Based on the snippet plugin from KDevelop 4.
3  *
4  * Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
5  * Copyright (C) 2010 Milian Wolff <mail@milianw.de>
6  * Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef __SNIPPETSTORE_H__
25 #define __SNIPPETSTORE_H__
26 
27 #include <QStandardItemModel>
28 #include <KConfigGroup>
29 
30 class SnippetRepository;
31 class KateSnippetGlobal;
32 
33 namespace KTextEditor {
34 class TemplateScriptRegistrar;
35 class TemplateScript;
36 }
37 
44 class SnippetStore : public QStandardItemModel
45 {
46  Q_OBJECT
47 
48 public:
52  static void init(KateSnippetGlobal* plugin);
56  static SnippetStore* self();
57 
58  virtual ~SnippetStore();
59  KConfigGroup getConfig();
60  virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
64  SnippetRepository* repositoryForFile(const QString &file);
65 
73  KTextEditor::TemplateScript* registerScript(const QString& script);
74 
80  void unregisterScript(KTextEditor::TemplateScript* token);
81 
82 private:
83  SnippetStore(KateSnippetGlobal* plugin);
84 
85  virtual Qt::ItemFlags flags (const QModelIndex & index) const;
86 
87  static SnippetStore* m_self;
88  KateSnippetGlobal* m_plugin;
89  KTextEditor::TemplateScriptRegistrar* m_scriptregistrar;
90 };
91 
92 #endif
93 
QStandardItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QModelIndex
QStandardItemModel
SnippetStore::~SnippetStore
virtual ~SnippetStore()
Definition: snippetstore.cpp:55
SnippetStore::unregisterScript
void unregisterScript(KTextEditor::TemplateScript *token)
Unregister script identified by token.
Definition: snippetstore.cpp:128
SnippetStore::registerScript
KTextEditor::TemplateScript * registerScript(const QString &script)
Register script to make it available in snippets.
Definition: snippetstore.cpp:135
SnippetStore::init
static void init(KateSnippetGlobal *plugin)
Initialize the SnippetStore.
Definition: snippetstore.cpp:61
SnippetStore::repositoryForFile
SnippetRepository * repositoryForFile(const QString &file)
Returns the repository for the given file if there is any.
Definition: snippetstore.cpp:116
SnippetStore
This class is implemented as singelton.
Definition: snippetstore.h:44
QString
SnippetRepository
Each object of this type represents a repository of snippets.
Definition: snippetrepository.h:52
KateSnippetGlobal
This is the main class of KDevelop's snippet plugin.
Definition: katesnippetglobal.h:39
SnippetStore::getConfig
KConfigGroup getConfig()
Definition: snippetstore.cpp:81
SnippetStore::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: snippetstore.cpp:89
QVariant
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal