LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
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 
13 class QAbstractItemModel;
14 
22 class Q_DECL_EXPORT ITagsManager
23 {
24 public:
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 
154 Q_DECLARE_INTERFACE (ITagsManager, "org.Deviant.LeechCraft.ITagsManager/1.0")
155 
156 #endif
QList< tag_id > GetIDs(const QStringList &tags)
Returns the IDs of the given tags.
Definition: itagsmanager.h:52
constexpr auto Join(auto &&) noexcept
Definition: ctstringutils.h:16
Tags manager&#39;s interface.
Definition: itagsmanager.h:22
virtual ~ITagsManager()
Definition: itagsmanager.h:27
QStringList GetTags(const QList< tag_id > &ids) const
Returns the tags with the given ids.
Definition: itagsmanager.h:84
QString tag_id
Definition: itagsmanager.h:25