diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index c388c751b..b46c0cd5c 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -260,4 +260,61 @@ class CZapitChannel }; }; +struct CmpChannelBySat: public std::binary_function +{ + static bool comparetolower(const char a, const char b) + { + return tolower(a) < tolower(b); + }; + + bool operator() (const CZapitChannel * const c1, const CZapitChannel * const c2) + { + if(c1->getSatellitePosition() == c2->getSatellitePosition()) + return std::lexicographical_compare(c1->getName().begin(), c1->getName().end(), c2->getName().begin(), c2->getName().end(), comparetolower); + else + return c1->getSatellitePosition() < c2->getSatellitePosition(); + ; + }; +}; + +struct CmpChannelByFreq: public std::binary_function +{ + static bool comparetolower(const char a, const char b) + { + return tolower(a) < tolower(b); + }; + + bool operator() (const CZapitChannel * const c1, const CZapitChannel * const c2) + { + if(c1->getFreqId() == c2->getFreqId()) + return std::lexicographical_compare(c1->getName().begin(), c1->getName().end(), c2->getName().begin(), c2->getName().end(), comparetolower); + else + return c1->getFreqId() < c2->getFreqId(); + ; + }; +}; + +struct CmpChannelByChName: public std::binary_function +{ + static bool comparetolower(const char a, const char b) + { + return tolower(a) < tolower(b); + }; + + bool operator() (const CZapitChannel * const c1, const CZapitChannel * const c2) + { + return std::lexicographical_compare(c1->getName().begin(), c1->getName().end(), c2->getName().begin(), c2->getName().end(), comparetolower); + }; +}; + +struct CmpChannelByChNum: public std::binary_function +{ + bool operator() (const CZapitChannel * const c1, const CZapitChannel * const c2) + { + return c1->number < c2->number; + ; + }; +}; + + #endif /* __zapit_channel_h__ */