MythTV master
mythsorthelper.h
Go to the documentation of this file.
1// -*- Mode: c++ -*-
2// vim: set expandtab tabstop=4 shiftwidth=4
3
4#ifndef MYTHSORTHELPER_H_
5#define MYTHSORTHELPER_H_
6
7#include <QCoreApplication>
8 #include <QRegularExpression>
9#include <memory>
10#include "mythbaseexp.h"
11
12enum SortPrefixMode : std::uint8_t
13{
17};
18
19enum SortExclusionMode : std::uint8_t
20{
23};
24
29{
30 Q_DECLARE_TR_FUNCTIONS(MythSortHelper)
31
32 public:
34 explicit MythSortHelper(MythSortHelper *other);
35 MythSortHelper(Qt::CaseSensitivity case_sensitive, SortPrefixMode prefix_mode,
36 QString exclusions);
37
38 QString doTitle(const QString& title) const;
39 QString doPathname(const QString& pathname) const;
40
47 bool hasPrefixes(void) { return not m_prefixes.isEmpty(); }
48
49 QString getPrefixes(void) { return m_prefixes; }
50
51 private:
52 void MythSortHelperCommon(void);
53
55 Qt::CaseSensitivity m_caseSensitive {Qt::CaseInsensitive};
56
60
64 QString m_prefixes {QString()};
67 QRegularExpression m_prefixesRegex {QRegularExpression()};
70 QRegularExpression m_prefixesRegex2 {QRegularExpression()};
71
77 QString m_exclusions {"A to Z"};
79 QStringList m_exclList {QStringList()};
81};
82
83MBASE_PUBLIC std::shared_ptr<MythSortHelper> getMythSortHelper(void);
85
86
87#endif // MYTHSORTHELPER_H_
A class to consolidate all the soring functions.
bool hasPrefixes(void)
Does the language translation specify any prefixes.
QString getPrefixes(void)
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
MBASE_PUBLIC std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
SortExclusionMode
@ SortExclusionPrefix
@ SortExclusionMatch
MBASE_PUBLIC void resetMythSortHelper(void)
Delete the MythSortHelper singleton.
SortPrefixMode
@ SortPrefixToEnd
@ SortPrefixKeep
@ SortPrefixRemove