MythTV
master
|
A class to consolidate all the soring functions. More...
#include <mythsorthelper.h>
Public Member Functions | |
MythSortHelper () | |
Create a MythSortHelper object. More... | |
MythSortHelper (MythSortHelper *other) | |
Copy a MythSortHelper object. More... | |
MythSortHelper (Qt::CaseSensitivity case_sensitive, SortPrefixMode prefix_mode, QString exclusions) | |
Fully specify the creation of a MythSortHelper object. More... | |
QString | doTitle (const QString &title) const |
Create the sortable form of an title string. More... | |
QString | doPathname (const QString &pathname) const |
Create the sortable form of an item. More... | |
bool | hasPrefixes (void) |
Does the language translation specify any prefixes. More... | |
Private Member Functions | |
void | MythSortHelperCommon (void) |
Common code for creating a MythSortHelper object. More... | |
Private Attributes | |
Qt::CaseSensitivity | m_caseSensitive {Qt::CaseInsensitive} |
Whether sorting two strings should ignore upper/lower case. More... | |
SortPrefixMode | m_prefixMode {SortPrefixRemove} |
Whether or not to ignore prefix words (like A, An, and The) when sorting two strings. More... | |
QString | m_prefixes {QString()} |
A string containing the regular expression of prefixes to ignore when sorting. More... | |
QRegularExpression | m_prefixesRegex {QRegularExpression()} |
A regular expression used for removing a leading prefix. More... | |
QRegularExpression | m_prefixesRegex2 {QRegularExpression()} |
A regular expression used for moving leading prefix to the end of a string. More... | |
QString | m_exclusions {"A to Z"} |
A string containing names that should be ignored when greating the sortable form of a title. More... | |
QStringList | m_exclList {QStringList()} |
The m_exclusion string converted into a string list. More... | |
SortExclusionMode | m_exclMode {SortExclusionMatch} |
A class to consolidate all the soring functions.
Definition at line 28 of file mythsorthelper.h.
MythSortHelper::MythSortHelper | ( | ) |
Create a MythSortHelper object.
Create the object and read settings from the core context.
Definition at line 53 of file mythsorthelper.cpp.
|
explicit |
Copy a MythSortHelper object.
This function is required for the shared pointer code to work.
Definition at line 105 of file mythsorthelper.cpp.
MythSortHelper::MythSortHelper | ( | Qt::CaseSensitivity | case_sensitive, |
SortPrefixMode | prefix_mode, | ||
QString | exclusions | ||
) |
Fully specify the creation of a MythSortHelper object.
This function creates a MythSortHelper object based on the parameters provided. It does not attempt to retrieve the user's preferred preferences from the database.
Definition at line 85 of file mythsorthelper.cpp.
QString MythSortHelper::doTitle | ( | const QString & | title | ) | const |
Create the sortable form of an title string.
This function converts a title string to a version that can be used for sorting. Depending upon user settings, it may ignore the case of the string (by forcing all strings to lower case) and may strip the common prefix words "A", "An" and "The" from the beginning of the string.
title | The title of an item. |
Definition at line 167 of file mythsorthelper.cpp.
QString MythSortHelper::doPathname | ( | const QString & | pathname | ) | const |
Create the sortable form of an item.
This function converts a pathname to a version that can be used for sorting. Depending upon user settings, it may ignore the case of the string (by forcing all strings to lower case) and may strip the common prefix words "A", "An" and "The" from the beginning of each component in the pathname.
pathname | The pathname of an item. |
Definition at line 200 of file mythsorthelper.cpp.
|
inline |
Does the language translation specify any prefixes.
Returns true if there are prefixes defined. False if there are no prefixes specified.
Definition at line 47 of file mythsorthelper.h.
Referenced by MythSortHelperCommon().
|
private |
Common code for creating a MythSortHelper object.
Given an object with the three user specified parameters initialized, this function initializes the rest of the object.
Definition at line 14 of file mythsorthelper.cpp.
Referenced by MythSortHelper().
|
private |
Whether sorting two strings should ignore upper/lower case.
Definition at line 53 of file mythsorthelper.h.
Referenced by doPathname(), doTitle(), MythSortHelper(), and MythSortHelperCommon().
|
private |
Whether or not to ignore prefix words (like A, An, and The) when sorting two strings.
Definition at line 57 of file mythsorthelper.h.
Referenced by doPathname(), doTitle(), MythSortHelper(), and MythSortHelperCommon().
|
private |
A string containing the regular expression of prefixes to ignore when sorting.
The code will ensure that this is anchored to the start of the string.
Definition at line 62 of file mythsorthelper.h.
Referenced by MythSortHelper(), and MythSortHelperCommon().
|
private |
A regular expression used for removing a leading prefix.
It is created from m_prefixes.
Definition at line 65 of file mythsorthelper.h.
Referenced by doPathname(), doTitle(), MythSortHelper(), and MythSortHelperCommon().
|
private |
A regular expression used for moving leading prefix to the end of a string.
It is created from m_prefixes.
Definition at line 68 of file mythsorthelper.h.
Referenced by doPathname(), doTitle(), MythSortHelper(), and MythSortHelperCommon().
|
private |
A string containing names that should be ignored when greating the sortable form of a title.
Multiple titles should be separated by a semicolon. This provides a place to specify things like the show named "A to Z" should not have the prefix "A " sorted to the end of the name.
Definition at line 75 of file mythsorthelper.h.
Referenced by MythSortHelper(), and MythSortHelperCommon().
|
private |
The m_exclusion string converted into a string list.
Definition at line 77 of file mythsorthelper.h.
Referenced by doPathname(), doTitle(), MythSortHelper(), and MythSortHelperCommon().
|
private |
Definition at line 78 of file mythsorthelper.h.
Referenced by doTitle(), and MythSortHelper().