2014-09-27 09:25:14 +02:00
|
|
|
#ifndef __HELPERS_H
|
|
|
|
#define __HELPERS_H
|
|
|
|
|
|
|
|
#include <vdr/osd.h>
|
|
|
|
#include <vdr/plugin.h>
|
|
|
|
#include "../config.h"
|
|
|
|
|
|
|
|
cPlugin *GetScraperPlugin(void);
|
|
|
|
|
|
|
|
cSize ScaleToFit(int widthMax, int heightMax, int widthOriginal, int heightOriginal);
|
|
|
|
int Minimum(int a, int b, int c, int d, int e, int f);
|
|
|
|
std::string CutText(string &text, int width, string fontName, int fontSize);
|
|
|
|
std::string StrToLowerCase(string str);
|
|
|
|
bool isNumber(const string& s);
|
2015-01-24 10:47:47 +01:00
|
|
|
bool IsToken(const string& token);
|
2014-10-26 08:47:24 +01:00
|
|
|
bool FileExists(const string &fullpath);
|
2014-09-27 09:25:14 +02:00
|
|
|
bool FileExists(const string &path, const string &name, const string &ext);
|
2014-10-03 15:54:23 +02:00
|
|
|
bool FolderExists(const string &path);
|
2014-09-27 09:25:14 +02:00
|
|
|
bool FirstFileInFolder(string &path, string &extension, string &fileName);
|
2015-06-13 10:46:11 +02:00
|
|
|
void CreateFolder(string &path);
|
2014-09-27 09:25:14 +02:00
|
|
|
|
2014-10-11 16:31:39 +02:00
|
|
|
string <rim(string &s);
|
|
|
|
string &rtrim(string &s);
|
|
|
|
string &trim(string &s);
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cStopWatch {
|
|
|
|
private:
|
|
|
|
uint64_t start;
|
|
|
|
uint64_t last;
|
|
|
|
public:
|
2014-11-02 17:32:22 +01:00
|
|
|
cStopWatch(const char* message = NULL);
|
2014-09-27 09:25:14 +02:00
|
|
|
~cStopWatch(void) {};
|
|
|
|
void Report(const char* message);
|
|
|
|
void Stop(const char* message);
|
|
|
|
};
|
2014-10-20 17:35:52 +02:00
|
|
|
|
2015-07-25 14:19:32 +02:00
|
|
|
string GetTimeString(int seconds);
|
|
|
|
|
2014-10-20 17:35:52 +02:00
|
|
|
string GetScreenResolutionString(int width, int height, bool *isHD);
|
|
|
|
string GetScreenAspectString(double aspect, bool *isWideScreen);
|
|
|
|
|
2014-09-27 09:25:14 +02:00
|
|
|
#endif // __HELPERS_H
|