LeechCraft 0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
ITagsManager Class Referenceabstract

Tags manager's interface. More...

#include "itagsmanager.h"

Collaboration diagram for ITagsManager:

Public Member Functions

virtual ~ITagsManager ()
const LC::Util::Emitters::TagsManager & GetEmitter () const
 Returns the emitter of this manager's signals.
virtual std::optional< LC::TagId > GetID (const QString &tag)=0
 Returns the ID of the given tag.
QList< LC::TagId > GetIDs (const QStringList &tags)
 Returns the IDs of the given tags.
virtual QStringList GetTags (const LC::TagId &id) const =0
 Returns the tags denoted by the given id.
QStringList GetTags (const QList< LC::TagId > &ids) const
 Returns the tags denoted by the given ids.
virtual QStringList GetAllTags () const =0
 Returns all tags existing in LeechCraft now.
virtual QStringList Split (const QString &string) const =0
 Splits the given string with tags to the list of the tags.
virtual QList< LC::TagId > SplitToIDs (const QString &string)=0
 Splits the given string with tags and returns tags IDs.
virtual QString Join (const QStringList &tags) const =0
 Joins the given tags into one string that's suitable to display to the user.
virtual QString JoinIDs (const QList< LC::TagId > &tagIDs) const =0
 Joins the given tag IDs into one human-readable string.
virtual QAbstractItemModel * GetModel ()=0
 Returns the model listing the tag names.

Protected Attributes

LC::Util::Emitters::TagsManager Emitter_

Detailed Description

Tags manager's interface.

This interface is for communication with the tags manager.

Tag names are trimmed and non-blank, and they don't contain the delimiter (per Util::GetTagsDelimiter()) the tags are split by. Tags are referred to by LC::TagIds, and an id may denote several tags (say, after a tag was split). Changes of the tags denoted by existing ids are announced by GetEmitter().

Definition at line 90 of file itagsmanager.h.

Constructor & Destructor Documentation

◆ ~ITagsManager()

virtual ITagsManager::~ITagsManager ( )
inlinevirtual

Definition at line 95 of file itagsmanager.h.

Member Function Documentation

◆ GetAllTags()

virtual QStringList ITagsManager::GetAllTags ( ) const
pure virtual

Returns all tags existing in LeechCraft now.

Returns
List of all tags.

◆ GetEmitter()

const LC::Util::Emitters::TagsManager & ITagsManager::GetEmitter ( ) const
inline

Returns the emitter of this manager's signals.

Definition at line 99 of file itagsmanager.h.

References Emitter_.

Referenced by LC::Util::TagsFoldersProxyModel::TagsFoldersProxyModel().

Here is the caller graph for this function:

◆ GetID()

virtual std::optional< LC::TagId > ITagsManager::GetID ( const QString & tag)
pure virtual

Returns the ID of the given tag.

If there is no such tag, it's added to the tag collection and the id of the new tag is returned.

If the tag is invalid, std::nullopt is returned.

Parameters
[in]tagThe tag that should be identified.
Returns
The ID of the tag, or std::nullopt if tag is blank or contains the delimiter.
See also
GetTags()
GetIDs()

Referenced by GetIDs().

Here is the caller graph for this function:

◆ GetIDs()

QList< LC::TagId > ITagsManager::GetIDs ( const QStringList & tags)
inline

Returns the IDs of the given tags.

This convenience function invokes GetID() for each tag in tags and returns the list of the corresponding tag IDs. The tags rejected by GetID() are skipped.

Parameters
[in]tagsThe tags that should be identified.
Returns
The IDs of the tags.
See also
GetID()

Definition at line 128 of file itagsmanager.h.

References GetID().

Here is the call graph for this function:

◆ GetModel()

virtual QAbstractItemModel * ITagsManager::GetModel ( )
pure virtual

Returns the model listing the tag names.

The model has one column and a row per distinct tag name, holding the name in both Qt::DisplayRole and Qt::EditRole, and follows the changes made through this manager. It is owned by the manager.

Returns
The tag names model.

◆ GetTags() [1/2]

virtual QStringList ITagsManager::GetTags ( const LC::TagId & id) const
pure virtual

Returns the tags denoted by the given id.

If there is no such tag, an empty list is returned. A sensible plugin would delete the given id from the list of assigned tags for all the items with this id.

Parameters
[in]idThe id of the tags.
Returns
The tags, or an empty list if there is no tag with the given id.
See also
GetID()
GetTags(const QList<LC::TagId>&)

Referenced by GetTags().

Here is the caller graph for this function:

◆ GetTags() [2/2]

QStringList ITagsManager::GetTags ( const QList< LC::TagId > & ids) const
inline

Returns the tags denoted by the given ids.

This convenience function invokes GetTags() for each tag ID in ids and returns the union of the results, each tag once, in the order of first occurrence.

Parameters
[in]idsThe ids of the tags.
Returns
The tags corresponding to the ids.
See also
GetTags(const LC::TagId&)

Definition at line 163 of file itagsmanager.h.

References GetTags().

Here is the call graph for this function:

◆ Join()

virtual QString ITagsManager::Join ( const QStringList & tags) const
pure virtual

Joins the given tags into one string that's suitable to display to the user.

Parameters
[in]tagsList of tags.
Returns
The joined string with tags.

◆ JoinIDs()

virtual QString ITagsManager::JoinIDs ( const QList< LC::TagId > & tagIDs) const
pure virtual

Joins the given tag IDs into one human-readable string.

This function is essentially a combination of GetTags() and Join(). First, it converts all given tagIDs into tag names using GetTags() and then joins them using Join(). This function is provided for convenience.

Parameters
[in]tagIDsList of tag IDs.
Returns
The joined string with tags.

◆ Split()

virtual QStringList ITagsManager::Split ( const QString & string) const
pure virtual

Splits the given string with tags to the list of the tags.

Parameters
[in]stringString with tags.
Returns
The list of the tags.

◆ SplitToIDs()

virtual QList< LC::TagId > ITagsManager::SplitToIDs ( const QString & string)
pure virtual

Splits the given string with tags and returns tags IDs.

This function is essentially a combination of Split() and GetID(). First, the given string is split into human-readable tags, and then for each tag its ID is obtained.

Parameters
[in]stringString with tags.
Returns
The list of the tags IDs.

Member Data Documentation

◆ Emitter_

LC::Util::Emitters::TagsManager ITagsManager::Emitter_
protected

Definition at line 93 of file itagsmanager.h.

Referenced by GetEmitter().


The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/leechcraft-doc-0.6.70+git.19424.g027e980fd1-build/leechcraft-0.6.70-19424-g027e980fd1/src/interfaces/core/itagsmanager.h