diff options
author | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
---|---|---|
committer | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
commit | e8a0e569152c50d6084f252d12854b8fd4e74466 (patch) | |
tree | 5a90ef7ea08ff2096df157ca109c5268cdc04903 /epgsearchtools.h | |
parent | 9c7d95ff8d6ba965cb23147507a859b1fd0491d6 (diff) | |
download | vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.gz vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.bz2 |
unified indentation
Diffstat (limited to 'epgsearchtools.h')
-rw-r--r-- | epgsearchtools.h | 101 |
1 files changed, 54 insertions, 47 deletions
diff --git a/epgsearchtools.h b/epgsearchtools.h index 7ad67f7..5c74318 100644 --- a/epgsearchtools.h +++ b/epgsearchtools.h @@ -75,7 +75,7 @@ using std::string; #define ISRADIO(x) ((x)->Vpid()==0||(x)->Vpid()==1||(x)->Vpid()==0x1fff) #ifndef MENU_SEPARATOR_ITEMS - #define MENU_SEPARATOR_ITEMS "----------------------------------------" +#define MENU_SEPARATOR_ITEMS "----------------------------------------" #endif #define UPDS_WITH_OSD (1<<1) @@ -119,7 +119,7 @@ class cSearchExt; class cSearchExtCat; class cEvent; -cString IndentMenuItem(const char*, int indentions=1); +cString IndentMenuItem(const char*, int indentions = 1); bool MatchesSearchMode(const char* test, const char* values, int searchmode, const char* delim, int tolerance); char* GetExtEPGValue(const cEvent* e, cSearchExtCat* SearchExtCat); char* GetExtEPGValue(const char* description, const char* catname, const char *format); @@ -135,15 +135,15 @@ std::string strreplace(std::string& result, const std::string& replaceWhat, cons // replace s1 with s2 in s ignoring the case of s1 inline char *strreplacei(char *s, const char *s1, const char s2) { - char *p = strcasestr(s, s1); - if (p) { - int offset = p - s; - int l = strlen(s); - int l1 = strlen(s1); - memmove(s + offset + 1, s + offset + l1, l - offset - l1 + 1); - s[offset] = s2; - } - return s; + char *p = strcasestr(s, s1); + if (p) { + int offset = p - s; + int l = strlen(s); + int l1 = strlen(s1); + memmove(s + offset + 1, s + offset + l1, l - offset - l1 + 1); + s[offset] = s2; + } + return s; } void sleepMSec(long ms); @@ -161,7 +161,7 @@ void PrepareTimerFile(const cEvent* event, cTimer* timer); int CompareEventTime(const void *p1, const void *p2); int CompareEventChannel(const void *p1, const void *p2); int CompareSearchExtPrioDescTerm(const void *p1, const void *p2); -bool EventsMatch(const cEvent* event1, const cEvent* event2, bool compareTitle, int compareSubtitle, bool compareSummary, int compareDate, unsigned long catvaluesAvoidRepeat, int matchLimit=90); +bool EventsMatch(const cEvent* event1, const cEvent* event2, bool compareTitle, int compareSubtitle, bool compareSummary, int compareDate, unsigned long catvaluesAvoidRepeat, int matchLimit = 90); int ChannelNrFromEvent(const cEvent* pEvent); void DelTimer(int index); char* FixSeparators(char* buffer, char sep); @@ -184,50 +184,52 @@ ssize_t Writeline(int sockd, const char *vptr, ssize_t n); long getAddrFromString(const char* hostnameOrIp, struct sockaddr_in* addr); // --- cTimerObj -------------------------------------------------------- -class cTimerObj : public cListObject { +class cTimerObj : public cListObject +{ public: const cTimer* timer; cTimerObj(const cTimer* Timer) : timer(Timer) {} - virtual ~cTimerObj() { timer = NULL; } // do not delete anything! + virtual ~cTimerObj() { + timer = NULL; // do not delete anything! + } }; // --- cTimerObjList -------------------------------------------------------- -class cTimerObjList : public cList<cTimerObj> { +class cTimerObjList : public cList<cTimerObj> +{ public: - void DelTimer(const cTimer* t) - { - for (cTimerObj* pTObj = First(); pTObj; pTObj = Next(pTObj)) - if (pTObj->timer == t) - { - Del(pTObj); - return; - } - } + void DelTimer(const cTimer* t) { + for (cTimerObj* pTObj = First(); pTObj; pTObj = Next(pTObj)) + if (pTObj->timer == t) { + Del(pTObj); + return; + } + } }; // --- icstring ------------------------------------------ // a case-insensitive string class struct ignorecase_traits : public std:: #if defined(__GNUC__) && __GNUC__ < 3 && __GNUC_MINOR__ < 96 -string_char_traits<char> + string_char_traits<char> #else -char_traits<char> + char_traits<char> #endif { // return whether c1 and c2 are equal static bool eq(const char& c1, const char& c2) { - return (c1==c2 || std::toupper(c1)==std::toupper(c2)); + return (c1 == c2 || std::toupper(c1) == std::toupper(c2)); } // return whether c1 is less than c2 static bool lt(const char& c1, const char& c2) { - return std::toupper(c1)<std::toupper(c2); + return std::toupper(c1) < std::toupper(c2); } // compare up to n characters of s1 and s2 static int compare(const char* s1, const char* s2, std::size_t n) { - for (std::size_t i=0; i<n; ++i) { - if (!eq(s1[i],s2[i])) { - return lt(s1[i],s2[i])?-1:1; + for (std::size_t i = 0; i < n; ++i) { + if (!eq(s1[i], s2[i])) { + return lt(s1[i], s2[i]) ? -1 : 1; } } return 0; @@ -235,8 +237,8 @@ char_traits<char> // search c in s static const char* find(const char* s, std::size_t n, const char& c) { - for (std::size_t i=0; i<n; ++i) { - if (eq(s[i],c)) { + for (std::size_t i = 0; i < n; ++i) { + if (eq(s[i], c)) { return &(s[i]); } } @@ -245,27 +247,32 @@ char_traits<char> }; // define a special type for such strings -typedef std::basic_string<char,ignorecase_traits> icstring; +typedef std::basic_string<char, ignorecase_traits> icstring; // --- eTimerMod ------------------------------------------------------------- -enum eTimerMod { tmNoChange=0, tmStartStop=1, tmFile=2, tmAuxEventID=4 }; +enum eTimerMod { tmNoChange = 0, tmStartStop = 1, tmFile = 2, tmAuxEventID = 4 }; // --- cCommands ------------------------------------------------------------------- -class cCommand : public cListObject { +class cCommand : public cListObject +{ private: - char *title; - char *command; - bool confirm; - static char *result; + char *title; + char *command; + bool confirm; + static char *result; public: - cCommand(void); - virtual ~cCommand(); - bool Parse(const char *s); - const char *Title(void) { return title; } - bool Confirm(void) { return confirm; } - const char *Execute(const char *Parameters = NULL); - }; + cCommand(void); + virtual ~cCommand(); + bool Parse(const char *s); + const char *Title(void) { + return title; + } + bool Confirm(void) { + return confirm; + } + const char *Execute(const char *Parameters = NULL); +}; class cCommands : public cConfig<cCommand> {}; |