Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
SortUtils.cpp File Reference
#include "SortUtils.h"
#include "LangInfo.h"
#include "URL.h"
#include "Util.h"
#include "utils/CharsetConverter.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
#include <algorithm>
#include <inttypes.h>

Classes

struct  sort_map
 

Functions

std::string ArrayToString (SortAttribute attributes, const CVariant &variant, const std::string &separator=" / ")
 
std::string ByLabel (SortAttribute attributes, const SortItem &values)
 
std::string ByFile (SortAttribute attributes, const SortItem &values)
 
std::string ByPath (SortAttribute attributes, const SortItem &values)
 
std::string ByLastPlayed (SortAttribute attributes, const SortItem &values)
 
std::string ByPlaycount (SortAttribute attributes, const SortItem &values)
 
std::string ByDate (SortAttribute attributes, const SortItem &values)
 
std::string ByDateAdded (SortAttribute attributes, const SortItem &values)
 
std::string BySize (SortAttribute attributes, const SortItem &values)
 
std::string ByDriveType (SortAttribute attributes, const SortItem &values)
 
std::string ByTitle (SortAttribute attributes, const SortItem &values)
 
std::string ByAlbum (SortAttribute attributes, const SortItem &values)
 
std::string ByAlbumType (SortAttribute attributes, const SortItem &values)
 
std::string ByArtist (SortAttribute attributes, const SortItem &values)
 
std::string ByArtistThenYear (SortAttribute attributes, const SortItem &values)
 
std::string ByTrackNumber (SortAttribute attributes, const SortItem &values)
 
std::string ByTotalDiscs (SortAttribute attributes, const SortItem &values)
 
std::string ByTime (SortAttribute attributes, const SortItem &values)
 
std::string ByProgramCount (SortAttribute attributes, const SortItem &values)
 
std::string ByPlaylistOrder (SortAttribute attributes, const SortItem &values)
 
std::string ByGenre (SortAttribute attributes, const SortItem &values)
 
std::string ByCountry (SortAttribute attributes, const SortItem &values)
 
std::string ByYear (SortAttribute attributes, const SortItem &values)
 
std::string ByOrigDate (SortAttribute attributes, const SortItem &values)
 
std::string BySortTitle (SortAttribute attributes, const SortItem &values)
 
std::string ByOriginalTitle (SortAttribute attributes, const SortItem &values)
 
std::string ByRating (SortAttribute attributes, const SortItem &values)
 
std::string ByUserRating (SortAttribute attributes, const SortItem &values)
 
std::string ByVotes (SortAttribute attributes, const SortItem &values)
 
std::string ByTop250 (SortAttribute attributes, const SortItem &values)
 
std::string ByMPAA (SortAttribute attributes, const SortItem &values)
 
std::string ByStudio (SortAttribute attributes, const SortItem &values)
 
std::string ByEpisodeNumber (SortAttribute attributes, const SortItem &values)
 
std::string BySeason (SortAttribute attributes, const SortItem &values)
 
std::string ByNumberOfEpisodes (SortAttribute attributes, const SortItem &values)
 
std::string ByNumberOfWatchedEpisodes (SortAttribute attributes, const SortItem &values)
 
std::string ByTvShowStatus (SortAttribute attributes, const SortItem &values)
 
std::string ByTvShowTitle (SortAttribute attributes, const SortItem &values)
 
std::string ByProductionCode (SortAttribute attributes, const SortItem &values)
 
std::string ByVideoResolution (SortAttribute attributes, const SortItem &values)
 
std::string ByVideoCodec (SortAttribute attributes, const SortItem &values)
 
std::string ByVideoAspectRatio (SortAttribute attributes, const SortItem &values)
 
std::string ByAudioChannels (SortAttribute attributes, const SortItem &values)
 
std::string ByAudioCodec (SortAttribute attributes, const SortItem &values)
 
std::string ByAudioLanguage (SortAttribute attributes, const SortItem &values)
 
std::string BySubtitleLanguage (SortAttribute attributes, const SortItem &values)
 
std::string ByBitrate (SortAttribute attributes, const SortItem &values)
 
std::string ByListeners (SortAttribute attributes, const SortItem &values)
 
std::string ByRandom (SortAttribute attributes, const SortItem &values)
 
std::string ByChannel (SortAttribute attributes, const SortItem &values)
 
std::string ByChannelNumber (SortAttribute attributes, const SortItem &values)
 
std::string ByClientChannelOrder (SortAttribute attributes, const SortItem &values)
 
std::string ByProvider (SortAttribute attributes, const SortItem &values)
 
std::string ByUserPreference (SortAttribute attributes, const SortItem &values)
 
std::string ByDateTaken (SortAttribute attributes, const SortItem &values)
 
std::string ByRelevance (SortAttribute attributes, const SortItem &values)
 
std::string ByInstallDate (SortAttribute attributes, const SortItem &values)
 
std::string ByLastUpdated (SortAttribute attributes, const SortItem &values)
 
std::string ByLastUsed (SortAttribute attributes, const SortItem &values)
 
std::string ByBPM (SortAttribute attributes, const SortItem &values)
 
bool preliminarySort (const SortItem &left, const SortItem &right, bool handleFolder, bool &result, std::wstring &labelLeft, std::wstring &labelRight)
 
bool SorterAscending (const SortItem &left, const SortItem &right)
 
bool SorterDescending (const SortItem &left, const SortItem &right)
 
bool SorterIgnoreFoldersAscending (const SortItem &left, const SortItem &right)
 
bool SorterIgnoreFoldersDescending (const SortItem &left, const SortItem &right)
 
bool SorterIndirectAscending (const SortItemPtr &left, const SortItemPtr &right)
 
bool SorterIndirectDescending (const SortItemPtr &left, const SortItemPtr &right)
 
bool SorterIndirectIgnoreFoldersAscending (const SortItemPtr &left, const SortItemPtr &right)
 
bool SorterIndirectIgnoreFoldersDescending (const SortItemPtr &left, const SortItemPtr &right)
 
std::map< SortBy, SortUtils::SortPreparatorfillPreparators ()
 
std::map< SortBy, FieldsfillSortingFields ()
 
template<typename T >
TypeFromString (const std::map< std::string, T > &typeMap, const std::string &name, const T &defaultType)
 
template<typename T >
const std::string & TypeToString (const std::map< std::string, T > &typeMap, const T &value)
 

Variables

const sort_map table []
 
const std::map< std::string, SortBysortMethods
 Sort methods to translate string values to enum values.
 
const std::map< std::string, SortOrdersortOrders
 

Function Documentation

◆ ArrayToString()

std::string ArrayToString ( SortAttribute attributes,
const CVariant & variant,
const std::string & separator = " / " )

◆ ByAlbum()

std::string ByAlbum ( SortAttribute attributes,
const SortItem & values )

◆ ByAlbumType()

std::string ByAlbumType ( SortAttribute attributes,
const SortItem & values )

◆ ByArtist()

std::string ByArtist ( SortAttribute attributes,
const SortItem & values )

◆ ByArtistThenYear()

std::string ByArtistThenYear ( SortAttribute attributes,
const SortItem & values )

◆ ByAudioChannels()

std::string ByAudioChannels ( SortAttribute attributes,
const SortItem & values )

◆ ByAudioCodec()

std::string ByAudioCodec ( SortAttribute attributes,
const SortItem & values )

◆ ByAudioLanguage()

std::string ByAudioLanguage ( SortAttribute attributes,
const SortItem & values )

◆ ByBitrate()

std::string ByBitrate ( SortAttribute attributes,
const SortItem & values )

◆ ByBPM()

std::string ByBPM ( SortAttribute attributes,
const SortItem & values )

◆ ByChannel()

std::string ByChannel ( SortAttribute attributes,
const SortItem & values )

◆ ByChannelNumber()

std::string ByChannelNumber ( SortAttribute attributes,
const SortItem & values )

◆ ByClientChannelOrder()

std::string ByClientChannelOrder ( SortAttribute attributes,
const SortItem & values )

◆ ByCountry()

std::string ByCountry ( SortAttribute attributes,
const SortItem & values )

◆ ByDate()

std::string ByDate ( SortAttribute attributes,
const SortItem & values )

◆ ByDateAdded()

std::string ByDateAdded ( SortAttribute attributes,
const SortItem & values )

◆ ByDateTaken()

std::string ByDateTaken ( SortAttribute attributes,
const SortItem & values )

◆ ByDriveType()

std::string ByDriveType ( SortAttribute attributes,
const SortItem & values )

◆ ByEpisodeNumber()

std::string ByEpisodeNumber ( SortAttribute attributes,
const SortItem & values )

◆ ByFile()

std::string ByFile ( SortAttribute attributes,
const SortItem & values )

◆ ByGenre()

std::string ByGenre ( SortAttribute attributes,
const SortItem & values )

◆ ByInstallDate()

std::string ByInstallDate ( SortAttribute attributes,
const SortItem & values )

◆ ByLabel()

std::string ByLabel ( SortAttribute attributes,
const SortItem & values )

◆ ByLastPlayed()

std::string ByLastPlayed ( SortAttribute attributes,
const SortItem & values )

◆ ByLastUpdated()

std::string ByLastUpdated ( SortAttribute attributes,
const SortItem & values )

◆ ByLastUsed()

std::string ByLastUsed ( SortAttribute attributes,
const SortItem & values )

◆ ByListeners()

std::string ByListeners ( SortAttribute attributes,
const SortItem & values )

◆ ByMPAA()

std::string ByMPAA ( SortAttribute attributes,
const SortItem & values )

◆ ByNumberOfEpisodes()

std::string ByNumberOfEpisodes ( SortAttribute attributes,
const SortItem & values )

◆ ByNumberOfWatchedEpisodes()

std::string ByNumberOfWatchedEpisodes ( SortAttribute attributes,
const SortItem & values )

◆ ByOrigDate()

std::string ByOrigDate ( SortAttribute attributes,
const SortItem & values )

◆ ByOriginalTitle()

std::string ByOriginalTitle ( SortAttribute attributes,
const SortItem & values )

◆ ByPath()

std::string ByPath ( SortAttribute attributes,
const SortItem & values )

◆ ByPlaycount()

std::string ByPlaycount ( SortAttribute attributes,
const SortItem & values )

◆ ByPlaylistOrder()

std::string ByPlaylistOrder ( SortAttribute attributes,
const SortItem & values )
Todo
Playlist order is hacked into program count variable (not nice, but ok until 2.0)

◆ ByProductionCode()

std::string ByProductionCode ( SortAttribute attributes,
const SortItem & values )

◆ ByProgramCount()

std::string ByProgramCount ( SortAttribute attributes,
const SortItem & values )

◆ ByProvider()

std::string ByProvider ( SortAttribute attributes,
const SortItem & values )

◆ ByRandom()

std::string ByRandom ( SortAttribute attributes,
const SortItem & values )

◆ ByRating()

std::string ByRating ( SortAttribute attributes,
const SortItem & values )

◆ ByRelevance()

std::string ByRelevance ( SortAttribute attributes,
const SortItem & values )

◆ BySeason()

std::string BySeason ( SortAttribute attributes,
const SortItem & values )

◆ BySize()

std::string BySize ( SortAttribute attributes,
const SortItem & values )

◆ BySortTitle()

std::string BySortTitle ( SortAttribute attributes,
const SortItem & values )

◆ ByStudio()

std::string ByStudio ( SortAttribute attributes,
const SortItem & values )

◆ BySubtitleLanguage()

std::string BySubtitleLanguage ( SortAttribute attributes,
const SortItem & values )

◆ ByTime()

std::string ByTime ( SortAttribute attributes,
const SortItem & values )

◆ ByTitle()

std::string ByTitle ( SortAttribute attributes,
const SortItem & values )

◆ ByTop250()

std::string ByTop250 ( SortAttribute attributes,
const SortItem & values )

◆ ByTotalDiscs()

std::string ByTotalDiscs ( SortAttribute attributes,
const SortItem & values )

◆ ByTrackNumber()

std::string ByTrackNumber ( SortAttribute attributes,
const SortItem & values )

◆ ByTvShowStatus()

std::string ByTvShowStatus ( SortAttribute attributes,
const SortItem & values )

◆ ByTvShowTitle()

std::string ByTvShowTitle ( SortAttribute attributes,
const SortItem & values )

◆ ByUserPreference()

std::string ByUserPreference ( SortAttribute attributes,
const SortItem & values )

◆ ByUserRating()

std::string ByUserRating ( SortAttribute attributes,
const SortItem & values )

◆ ByVideoAspectRatio()

std::string ByVideoAspectRatio ( SortAttribute attributes,
const SortItem & values )

◆ ByVideoCodec()

std::string ByVideoCodec ( SortAttribute attributes,
const SortItem & values )

◆ ByVideoResolution()

std::string ByVideoResolution ( SortAttribute attributes,
const SortItem & values )

◆ ByVotes()

std::string ByVotes ( SortAttribute attributes,
const SortItem & values )

◆ ByYear()

std::string ByYear ( SortAttribute attributes,
const SortItem & values )

◆ fillPreparators()

std::map< SortBy, SortUtils::SortPreparator > fillPreparators ( )

◆ fillSortingFields()

std::map< SortBy, Fields > fillSortingFields ( )

◆ preliminarySort()

bool preliminarySort ( const SortItem & left,
const SortItem & right,
bool handleFolder,
bool & result,
std::wstring & labelLeft,
std::wstring & labelRight )

◆ SorterAscending()

bool SorterAscending ( const SortItem & left,
const SortItem & right )

◆ SorterDescending()

bool SorterDescending ( const SortItem & left,
const SortItem & right )

◆ SorterIgnoreFoldersAscending()

bool SorterIgnoreFoldersAscending ( const SortItem & left,
const SortItem & right )

◆ SorterIgnoreFoldersDescending()

bool SorterIgnoreFoldersDescending ( const SortItem & left,
const SortItem & right )

◆ SorterIndirectAscending()

bool SorterIndirectAscending ( const SortItemPtr & left,
const SortItemPtr & right )

◆ SorterIndirectDescending()

bool SorterIndirectDescending ( const SortItemPtr & left,
const SortItemPtr & right )

◆ SorterIndirectIgnoreFoldersAscending()

bool SorterIndirectIgnoreFoldersAscending ( const SortItemPtr & left,
const SortItemPtr & right )

◆ SorterIndirectIgnoreFoldersDescending()

bool SorterIndirectIgnoreFoldersDescending ( const SortItemPtr & left,
const SortItemPtr & right )

◆ TypeFromString()

template<typename T >
T TypeFromString ( const std::map< std::string, T > & typeMap,
const std::string & name,
const T & defaultType )

◆ TypeToString()

template<typename T >
const std::string & TypeToString ( const std::map< std::string, T > & typeMap,
const T & value )

Variable Documentation

◆ sortMethods

const std::map<std::string, SortBy> sortMethods

Sort methods to translate string values to enum values.

Warning
On string changes, edit SortBy enumerator to have strings right for documentation!

◆ sortOrders

const std::map<std::string, SortOrder> sortOrders
Initial value:
= {
{ "ascending", SortOrderAscending },
{ "descending", SortOrderDescending }
}
@ SortOrderDescending
Definition SortUtils.h:23
@ SortOrderAscending
Definition SortUtils.h:22

◆ table

const sort_map table[]