LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
itagsmanager.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#ifndef INTERFACES_CORE_ITAGSMANAGER_H
10#define INTERFACES_CORE_ITAGSMANAGER_H
11#include <QStringList>
12
13class QAbstractItemModel;
14
22class Q_DECL_EXPORT ITagsManager
23{
24public:
25 typedef QString tag_id;
26
27 virtual ~ITagsManager () {}
28
40 virtual tag_id GetID (const QString& tag) = 0;
41
52 QList<tag_id> GetIDs (const QStringList& tags)
53 {
54 QList<tag_id> result;
55 for (const auto& tag : tags)
56 result << GetID (tag);
57 return result;
58 }
59
72 virtual QString GetTag (tag_id id) const = 0;
73
84 QStringList GetTags (const QList<tag_id>& ids) const
85 {
86 QStringList result;
87 for (const auto& id : ids)
88 result << GetTag (id);
89 return result;
90 }
91
96 virtual QStringList GetAllTags () const = 0;
97
103 virtual QStringList Split (const QString& string) const = 0;
104
114 virtual QList<tag_id> SplitToIDs (const QString& string) = 0;
115
122 virtual QString Join (const QStringList& tags) const = 0;
123
134 virtual QString JoinIDs (const QStringList& tagIDs) const = 0;
135
144 virtual QAbstractItemModel* GetModel () = 0;
145
151 virtual QObject* GetQObject () = 0;
152};
153
154Q_DECLARE_INTERFACE (ITagsManager, "org.Deviant.LeechCraft.ITagsManager/1.0")
155
156#endif
Tags manager's interface.
virtual ~ITagsManager()
virtual QStringList GetAllTags() const =0
Returns all tags existing in LeechCraft now.
QStringList GetTags(const QList< tag_id > &ids) const
Returns the tags with the given ids.
QList< tag_id > GetIDs(const QStringList &tags)
Returns the IDs of the given tags.
virtual QList< tag_id > SplitToIDs(const QString &string)=0
Splits the given string with tags and returns tags IDs.
virtual QAbstractItemModel * GetModel()=0
Returns the completion model for this tags manager.
virtual QObject * GetQObject()=0
Returns the tags manager as a QObject to get access to all the meta-stuff.
virtual QString Join(const QStringList &tags) const =0
Joins the given tags into one string that's suitable to display to the user.
virtual QStringList Split(const QString &string) const =0
Splits the given string with tags to the list of the tags.
virtual QString GetTag(tag_id id) const =0
Returns the tag with the given id.
QString tag_id
virtual tag_id GetID(const QString &tag)=0
Returns the ID of the given tag.
virtual QString JoinIDs(const QStringList &tagIDs) const =0
Joins the given tag IDs into one human-readable string.