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 
13 {
17 };
18 
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_
mythbaseexp.h
SortExclusionMatch
@ SortExclusionMatch
Definition: mythsorthelper.h:21
MythSortHelper
A class to consolidate all the soring functions.
Definition: mythsorthelper.h:28
SortPrefixRemove
@ SortPrefixRemove
Definition: mythsorthelper.h:15
SortPrefixToEnd
@ SortPrefixToEnd
Definition: mythsorthelper.h:16
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
SortExclusionPrefix
@ SortExclusionPrefix
Definition: mythsorthelper.h:22
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
SortPrefixMode
SortPrefixMode
Definition: mythsorthelper.h:12
SortPrefixKeep
@ SortPrefixKeep
Definition: mythsorthelper.h:14
SortExclusionMode
SortExclusionMode
Definition: mythsorthelper.h:19