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 
12 enum SortPrefixMode : std::uint8_t
13 {
17 };
18 
19 enum 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  private:
50  void MythSortHelperCommon(void);
51 
53  Qt::CaseSensitivity m_caseSensitive {Qt::CaseInsensitive};
54 
58 
62  QString m_prefixes {QString()};
65  QRegularExpression m_prefixesRegex {QRegularExpression()};
68  QRegularExpression m_prefixesRegex2 {QRegularExpression()};
69 
75  QString m_exclusions {"A to Z"};
77  QStringList m_exclList {QStringList()};
79 };
80 
81 MBASE_PUBLIC std::shared_ptr<MythSortHelper> getMythSortHelper(void);
83 
84 
85 #endif // MYTHSORTHELPER_H_
SortExclusionPrefix
@ SortExclusionPrefix
Definition: mythsorthelper.h:22
mythbaseexp.h
SortPrefixRemove
@ SortPrefixRemove
Definition: mythsorthelper.h:15
MythSortHelper
A class to consolidate all the soring functions.
Definition: mythsorthelper.h:28
SortPrefixKeep
@ SortPrefixKeep
Definition: mythsorthelper.h:14
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
getMythSortHelper
MBASE_PUBLIC std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
Definition: mythsorthelper.cpp:129
SortExclusionMatch
@ SortExclusionMatch
Definition: mythsorthelper.h:21
SortExclusionMode
SortExclusionMode
Definition: mythsorthelper.h:19
MythSortHelper::hasPrefixes
bool hasPrefixes(void)
Does the language translation specify any prefixes.
Definition: mythsorthelper.h:47
resetMythSortHelper
MBASE_PUBLIC void resetMythSortHelper(void)
Delete the MythSortHelper singleton.
Definition: mythsorthelper.cpp:146
SortPrefixToEnd
@ SortPrefixToEnd
Definition: mythsorthelper.h:16
SortPrefixMode
SortPrefixMode
Definition: mythsorthelper.h:12