summaryrefslogtreecommitdiff
path: root/recman.cpp
diff options
context:
space:
mode:
authorRolf Ahrenberg <Rolf.Ahrenberg@sci.fi>2011-02-10 13:14:57 +0200
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-02-10 22:41:13 +0100
commit36485b88308aef886c2b99f07d574e4962d1969b (patch)
treeedda6855c83186cf41c602ba91e6800d8b1ea7c2 /recman.cpp
parent23562a42a5a5d776330b42823fe844493b574830 (diff)
downloadvdr-plugin-live-36485b88308aef886c2b99f07d574e4962d1969b.tar.gz
vdr-plugin-live-36485b88308aef886c2b99f07d574e4962d1969b.tar.bz2
Added support for sorting recordings by name and date in both ascending and descending orders.
Diffstat (limited to 'recman.cpp')
-rw-r--r--recman.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/recman.cpp b/recman.cpp
index db2d5fc..e9150b6 100644
--- a/recman.cpp
+++ b/recman.cpp
@@ -282,6 +282,54 @@ namespace vdrlive {
/**
+ * Implemetation of class RecordingsItemPtrCompare
+ */
+ bool RecordingsItemPtrCompare::ByAscendingDate(RecordingsItemPtr & first, RecordingsItemPtr & second)
+ {
+ if (first->StartTime() < second->StartTime())
+ return true;
+ return false;
+ }
+
+ bool RecordingsItemPtrCompare::ByDescendingDate(RecordingsItemPtr & first, RecordingsItemPtr & second)
+ {
+ if (first->StartTime() < second->StartTime())
+ return false;
+ return true;
+ }
+
+ bool RecordingsItemPtrCompare::ByAscendingName(RecordingsItemPtr & first, RecordingsItemPtr & second)
+ {
+ unsigned int i = 0;
+ while (i < first->Name().length() && i < second->Name().length()) {
+ if (tolower((first->Name())[i]) < tolower((second->Name())[i]))
+ return true;
+ else if (tolower((first->Name())[i]) > tolower((second->Name())[i]))
+ return false;
+ ++i;
+ }
+ if (first->Name().length() < second->Name().length())
+ return true;
+ return false;
+ }
+
+ bool RecordingsItemPtrCompare::ByDescendingName(RecordingsItemPtr & first, RecordingsItemPtr & second)
+ {
+ unsigned int i = 0;
+ while (i < first->Name().length() && i < second->Name().length()) {
+ if (tolower((second->Name())[i]) < tolower((first->Name())[i]))
+ return true;
+ else if (tolower((second->Name())[i]) > tolower((first->Name())[i]))
+ return false;
+ ++i;
+ }
+ if (second->Name().length() < first->Name().length())
+ return true;
+ return false;
+ }
+
+
+ /**
* Implementation of class RecordingsItem:
*/
RecordingsItem::RecordingsItem(string const & name, RecordingsItemPtr parent) :