summaryrefslogtreecommitdiff
path: root/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools.h')
-rw-r--r--tools.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools.h b/tools.h
new file mode 100644
index 0000000..f9bdb4e
--- /dev/null
+++ b/tools.h
@@ -0,0 +1,59 @@
+#ifndef __TVGUIDETOOLS_H
+#define __TVGUIDETOOLS_H
+
+#include <string>
+#include <vector>
+#include <vdr/font.h>
+
+std::string CutText(std::string text, int width, const cFont *font);
+
+class splitstring : public std::string {
+ std::vector<std::string> flds;
+public:
+ splitstring(const char *s) : std::string(s) { };
+ std::vector<std::string>& split(char delim, int rep=0);
+};
+
+int FindIgnoreCase(const std::string& expr, const std::string& query);
+
+#ifndef _AFUZZY_H
+#define _AFUZZY_H
+
+// source from:
+/*
+ Leonid Boitsov 2002. (itman@narod.ru)
+ C version of Stas Namin.
+ This code is a GPL software and is distributed under GNU
+ public licence without any warranty.
+*/
+
+typedef unsigned int Uint;
+
+#define MaxPatSize (sizeof(Uint) * 8)
+
+typedef struct
+{
+ Uint *R,
+ *R1,
+ *RP,
+ *S,
+ *RI;
+ Uint *FilterS;
+
+ int Map[256];
+ int FilterMap[256];
+ int k;
+ Uint mask_ok;
+ Uint filter_ok;
+ Uint filter_shift;
+ int r_size;
+ int FilterSet;
+} AFUZZY;
+
+void afuzzy_init(const char *p, int kerr, int UseFilter, AFUZZY *fuzzy);
+void afuzzy_free(AFUZZY *fuzzy);
+int afuzzy_checkSUB(const char *t, AFUZZY *fuzzy);
+static int afuzzy_checkFLT(const char *t, AFUZZY *fuzzy);
+#endif
+
+#endif // __TVGUIDETOOLS_H \ No newline at end of file