[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / utils / Utf8Utils.h
bloba29f64a4e90c19e6a4c718b9e4a324ac7f11546b
1 /*
2 * Copyright (C) 2013-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include <string>
13 class CUtf8Utils
15 public:
16 enum utf8CheckResult
18 plainAscii = -1, // only US-ASCII characters (valid for UTF-8 too)
19 hiAscii = 0, // non-UTF-8 sequence with high ASCII characters
20 // (possible single-byte national encoding like WINDOWS-1251, multi-byte encoding like UTF-32 or invalid UTF-8)
21 utf8string = 1 // valid UTF-8 sequences, but not US-ASCII only
24 /**
25 * Check given string for valid UTF-8 sequences
26 * @param str string to check
27 * @return result of check, "plainAscii" for empty string
29 static utf8CheckResult checkStrForUtf8(const std::string& str);
31 static inline bool isValidUtf8(const std::string& str)
33 return checkStrForUtf8(str) != hiAscii;
36 static size_t FindValidUtf8Char(const std::string& str, const size_t startPos = 0);
37 static size_t RFindValidUtf8Char(const std::string& str, const size_t startPos);
39 static size_t SizeOfUtf8Char(const std::string& str, const size_t charStart = 0);
40 private:
41 static size_t SizeOfUtf8Char(const char* const str);