| 1 |
#pragma once |
| 2 |
/* |
| 3 |
* taken from pvr:zattoo |
| 4 |
*/ |
| 5 |
#include <sstream> |
| 6 |
#include <string> |
| 7 |
#include <vector> |
| 8 |
|
| 9 |
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) |
| 10 |
#define timegm _mkgmtime |
| 11 |
#endif |
| 12 |
|
| 13 |
class Utils |
| 14 |
{ |
| 15 |
public: |
| 16 |
static std::string GetFilePath(std::string strPath, bool bUserPath = true); |
| 17 |
static std::string UrlEncode(const std::string& string); |
| 18 |
static std::string ReadFile(const std::string& path); |
| 19 |
static time_t StringToTime(std::string timeString); |
| 20 |
static std::string TimeToString(time_t time); |
| 21 |
static int GetIDDirty(std::string str); |
| 22 |
static int Hash(const std::string& str); |
| 23 |
static int StringToInt(std::string str, int defaultValue); |
| 24 |
static std::string Replace(std::string str, const std::string& from, const std::string& to); |
| 25 |
static std::string CreateUUID(); |
| 26 |
static bool FileDownload(std::string url, std::string targetFile); |
| 27 |
static bool CheckInputstreamInstalledAndEnabled(const std::string& inputstreamName); |
| 28 |
}; |