mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-01 01:41:23 +02:00
zapit/include/zapit/channel.h: add cmpChannel.. functions
This commit is contained in:
@@ -260,4 +260,61 @@ class CZapitChannel
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CmpChannelBySat: public std::binary_function <const CZapitChannel * const, const CZapitChannel * const, bool>
|
||||||
|
{
|
||||||
|
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 <const CZapitChannel * const, const CZapitChannel * const, bool>
|
||||||
|
{
|
||||||
|
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 <const CZapitChannel * const, const CZapitChannel * const, bool>
|
||||||
|
{
|
||||||
|
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 <const CZapitChannel * const, const CZapitChannel * const, bool>
|
||||||
|
{
|
||||||
|
bool operator() (const CZapitChannel * const c1, const CZapitChannel * const c2)
|
||||||
|
{
|
||||||
|
return c1->number < c2->number;
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* __zapit_channel_h__ */
|
#endif /* __zapit_channel_h__ */
|
||||||
|
Reference in New Issue
Block a user