Merge branch 'master' into jgrpp
# Conflicts: # src/cargotype.h # src/core/CMakeLists.txt # src/core/span_type.hpp # src/fileio.cpp # src/fios.cpp # src/misc/endian_buffer.hpp # src/misc_gui.cpp # src/saveload/saveload.h # src/saveload/vehicle_sl.cpp # src/screenshot.cpp # src/settings.cpp # src/settings_internal.h # src/stdafx.h # src/string_func.h # src/strings.cpp # src/strings_func.h # src/strings_internal.h
This commit is contained in:
@@ -210,7 +210,7 @@ const char *str_fix_scc_encoded(char *str, const char *last)
|
||||
* @param data Array to format
|
||||
* @return Converted string.
|
||||
*/
|
||||
std::string FormatArrayAsHex(span<const byte> data)
|
||||
std::string FormatArrayAsHex(std::span<const byte> data)
|
||||
{
|
||||
std::string hex_output;
|
||||
hex_output.resize(data.size() * 2);
|
||||
@@ -431,19 +431,6 @@ const char *StrLastPathSegment(const char *path)
|
||||
return best;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given string starts with the given prefix.
|
||||
* @param str The string to look at.
|
||||
* @param prefix The prefix to look for.
|
||||
* @return True iff the begin of the string is the same as the prefix.
|
||||
*/
|
||||
bool StrStartsWith(const std::string_view str, const std::string_view prefix)
|
||||
{
|
||||
size_t prefix_len = prefix.size();
|
||||
if (str.size() < prefix_len) return false;
|
||||
return str.compare(0, prefix_len, prefix, 0, prefix_len) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given string starts with the given prefix, ignoring case.
|
||||
* @param str The string to look at.
|
||||
@@ -456,19 +443,6 @@ bool StrStartsWithIgnoreCase(std::string_view str, const std::string_view prefix
|
||||
return StrEqualsIgnoreCase(str.substr(0, prefix.size()), prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given string ends with the given suffix.
|
||||
* @param str The string to look at.
|
||||
* @param suffix The suffix to look for.
|
||||
* @return True iff the end of the string is the same as the suffix.
|
||||
*/
|
||||
bool StrEndsWith(const std::string_view str, const std::string_view suffix)
|
||||
{
|
||||
size_t suffix_len = suffix.size();
|
||||
if (str.size() < suffix_len) return false;
|
||||
return str.compare(str.size() - suffix_len, suffix_len, suffix, 0, suffix_len) == 0;
|
||||
}
|
||||
|
||||
/** Case insensitive implementation of the standard character type traits. */
|
||||
struct CaseInsensitiveCharTraits : public std::char_traits<char> {
|
||||
static bool eq(char c1, char c2) { return toupper(c1) == toupper(c2); }
|
||||
|
Reference in New Issue
Block a user