summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--tools.h15
3 files changed, 16 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b0991c44..301e1b1c 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -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
diff --git a/HISTORY b/HISTORY
index 7dba3020..117f2a2b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/tools.h b/tools.h
index f17c5642..c593c7f8 100644
--- a/tools.h
+++ b/tools.h
@@ -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);
};