Snippets: Make it easier for plugins to add snippets groups

Groups are no longer enum values but identified from snippet providers.
This commit is contained in:
Leandro Melo
2010-12-02 17:02:23 +01:00
parent fdbb34adb8
commit 1175705bfc
32 changed files with 411 additions and 272 deletions

View File

@@ -30,41 +30,15 @@
#ifndef REUSE_H
#define REUSE_H
#include "snippet.h"
#include <QtCore/QString>
#include <QtCore/QLatin1String>
namespace TextEditor {
namespace Internal {
const QLatin1String kCpp("C++");
const QLatin1String kQml("QML");
const QLatin1String kText("Text");
const QLatin1String kTrue("true");
const QLatin1String kFalse("false");
inline Snippet::Group toSnippetGroup(const QString &s)
{
const QString &upper = s.toUpper();
if (upper == kCpp)
return Snippet::Cpp;
else if (upper == kQml)
return Snippet::Qml;
else
return Snippet::PlainText;
}
inline QString fromSnippetGroup(Snippet::Group group)
{
if (group == Snippet::Cpp)
return kCpp;
else if (group == Snippet::Qml)
return kQml;
else
return kText;
}
inline bool toBool(const QString &s)
{
if (s == kTrue)