Debian Codegraph @

src/utils.h

raw
1 /*
2 * Copyright (C) 2005-2021 Team Kodi (https://kodi.tv)
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 * See LICENSE.md for more information.
6 */
7
8 #pragma once
9
10 #include <string>
11 #include <vector>
12 #include <ctime>
13 #include "uri.h"
14
15 #ifdef TARGET_WINDOWS
16 #include "windows/WindowsUtils.h"
17 #endif
18
19 /**
20 * String tokenize
21 * Split string using the given delimiter into a vector of substrings
22 */
23 void Tokenize(const std::string& str, std::vector<std::string>& tokens, const std::string& delimiters);
24
25 std::wstring StringToWString(const std::string& s);
26 std::string WStringToString(const std::wstring& s);
27 std::string lowercase(const std::string& s);
28 bool stringtobool(const std::string& s);
29 const char* booltostring(const bool b);
30
31 /**
32 * @brief Filters forbidden filename characters from channel name and replaces them with _ )
33 */
34 std::string ToThumbFileName(const char* strChannelName);
35
36 std::string ToKodiPath(const std::string& strFileName);
37 std::string ToWindowsPath(const std::string& strFileName);
38
39 /**
40 * @brief Macro to silence unused parameter warnings
41 */
42 #ifdef UNUSED
43 # undef UNUSED
44 #endif
45 #ifdef __GNUC__
46 # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
47 #else
48 # define UNUSED(x) /* x */
49 #endif