diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-12 14:05:56 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-12 14:05:56 +0200 |
commit | ce14873e8987c8a0628812cb5dfb1d9814842fd4 (patch) | |
tree | 7c0aa5ed4d3af8192c4d3ecc99ea9a3b00bf00f9 /tools.h | |
parent | b863d9a7024fdc4d31571565e3afe646dedffa9f (diff) | |
download | vdr-ce14873e8987c8a0628812cb5dfb1d9814842fd4.tar.gz vdr-ce14873e8987c8a0628812cb5dfb1d9814842fd4.tar.bz2 |
cStringList::Sort() can now be called with a boolean parameter that controls case insensitive sorting
Diffstat (limited to 'tools.h')
-rw-r--r-- | tools.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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); }; |