1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

cStringList::Sort() can now be called with a boolean parameter that controls case insensitive sorting

This commit is contained in:
Klaus Schmidinger 2011-08-12 14:05:56 +02:00
parent b863d9a702
commit ce14873e89
3 changed files with 16 additions and 2 deletions

View File

@ -2513,6 +2513,7 @@ Johan Schuring <johan.schuring@vetteblei.nl>
Sundararaj Reel <sundararaj.reel@googlemail.com>
for reporting a missing reset of maxNumber in cChannels::Renumber()
for reporting some missing 'const' in tChannelID
for suggesting to add optional case insensitive sorting to cStringList::Sort()
Ales Jurik <ajurik@quick.cz>
for reporting broken SI data on Czech/Slovak channels after changing the default

View File

@ -6674,3 +6674,5 @@ Video Disk Recorder Revision History
that broadcast the frame type within the first TS packet of a payload; it only
kicks in if that information is not in the first TS packet.
- Fixed handling the channelID in cMenuEditChanItem (thanks to Udo Richter).
- cStringList::Sort() can now be called with a boolean parameter that controls
case insensitive sorting (suggested by Sundararaj Reel).

15
tools.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 2.7 2011/02/25 15:05:58 kls Exp $
* $Id: tools.h 2.8 2011/08/12 14:04:00 kls Exp $
*/
#ifndef __TOOLS_H
@ -506,12 +506,23 @@ inline int CompareStrings(const void *a, const void *b)
return strcmp(*(const char **)a, *(const char **)b);
}
inline int CompareStringsIgnoreCase(const void *a, const void *b)
{
return strcasecmp(*(const char **)a, *(const char **)b);
}
class cStringList : public cVector<char *> {
public:
cStringList(int Allocated = 10): cVector<char *>(Allocated) {}
virtual ~cStringList();
int Find(const char *s) const;
void Sort(void) { cVector<char *>::Sort(CompareStrings); }
void Sort(bool IgnoreCase = false)
{
if (IgnoreCase)
cVector<char *>::Sort(CompareStringsIgnoreCase);
else
cVector<char *>::Sort(CompareStrings);
}
virtual void Clear(void);
};