Core/StringExt: Don't pass string_view by ref

https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/
This commit is contained in:
SirLynix
2023-08-24 08:23:14 +02:00
parent 1b7a89213d
commit bd53245f42
51 changed files with 115 additions and 115 deletions

View File

@@ -18,55 +18,55 @@ namespace Nz
struct UnicodeAware {};
// std::string is assumed to contains UTF-8
NAZARA_CORE_API std::size_t ComputeCharacterCount(const std::string_view& str);
NAZARA_CORE_API std::size_t ComputeCharacterCount(std::string_view str);
inline bool EndsWith(const std::string_view& str, const std::string_view& s);
NAZARA_CORE_API bool EndsWith(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent);
NAZARA_CORE_API bool EndsWith(const std::string_view& lhs, const std::string_view& rhs, UnicodeAware);
NAZARA_CORE_API bool EndsWith(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent, UnicodeAware);
inline bool EndsWith(std::string_view str, std::string_view s);
NAZARA_CORE_API bool EndsWith(std::string_view lhs, std::string_view rhs, CaseIndependent);
NAZARA_CORE_API bool EndsWith(std::string_view lhs, std::string_view rhs, UnicodeAware);
NAZARA_CORE_API bool EndsWith(std::string_view lhs, std::string_view rhs, CaseIndependent, UnicodeAware);
NAZARA_CORE_API std::string FromUtf16String(const std::u16string_view& u16str);
NAZARA_CORE_API std::string FromUtf32String(const std::u32string_view& u32str);
NAZARA_CORE_API std::string FromWideString(const std::wstring_view& str);
NAZARA_CORE_API std::string FromUtf16String(std::u16string_view u16str);
NAZARA_CORE_API std::string FromUtf32String(std::u32string_view u32str);
NAZARA_CORE_API std::string FromWideString(std::wstring_view str);
NAZARA_CORE_API std::size_t GetCharacterPosition(const std::string_view& str, std::size_t characterIndex);
NAZARA_CORE_API std::string_view GetWord(const std::string_view& str, std::size_t wordIndex);
NAZARA_CORE_API std::string_view GetWord(const std::string_view& str, std::size_t wordIndex, UnicodeAware);
NAZARA_CORE_API std::size_t GetCharacterPosition(std::string_view str, std::size_t characterIndex);
NAZARA_CORE_API std::string_view GetWord(std::string_view str, std::size_t wordIndex);
NAZARA_CORE_API std::string_view GetWord(std::string_view str, std::size_t wordIndex, UnicodeAware);
inline bool IsNumber(std::string_view str);
NAZARA_CORE_API bool MatchPattern(const std::string_view& str, const std::string_view& pattern);
NAZARA_CORE_API bool MatchPattern(std::string_view str, std::string_view pattern);
inline std::string NumberToString(long long number, UInt8 radix = 10);
NAZARA_CORE_API std::string PointerToString(const void* ptr);
inline std::string& ReplaceStr(std::string& str, const std::string_view& from, const std::string_view& to);
inline std::string& ReplaceStr(std::string& str, std::string_view from, std::string_view to);
inline bool StartsWith(const std::string_view& str, const std::string_view& s);
NAZARA_CORE_API bool StartsWith(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent);
NAZARA_CORE_API bool StartsWith(const std::string_view& lhs, const std::string_view& rhs, UnicodeAware);
NAZARA_CORE_API bool StartsWith(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent, UnicodeAware);
inline bool StartsWith(std::string_view str, std::string_view s);
NAZARA_CORE_API bool StartsWith(std::string_view lhs, std::string_view rhs, CaseIndependent);
NAZARA_CORE_API bool StartsWith(std::string_view lhs, std::string_view rhs, UnicodeAware);
NAZARA_CORE_API bool StartsWith(std::string_view lhs, std::string_view rhs, CaseIndependent, UnicodeAware);
template<typename F> bool SplitString(const std::string_view& str, const std::string_view& token, F&& func);
template<typename F> bool SplitStringAny(const std::string_view& str, const std::string_view& token, F&& func);
template<typename F> bool SplitString(std::string_view str, std::string_view token, F&& func);
template<typename F> bool SplitStringAny(std::string_view str, std::string_view token, F&& func);
inline bool StringEqual(const std::string_view& lhs, const std::string_view& rhs);
inline bool StringEqual(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent);
NAZARA_CORE_API bool StringEqual(const std::string_view& lhs, const std::string_view& rhs, UnicodeAware);
NAZARA_CORE_API bool StringEqual(const std::string_view& lhs, const std::string_view& rhs, CaseIndependent, UnicodeAware);
inline bool StringEqual(std::string_view lhs, std::string_view rhs);
inline bool StringEqual(std::string_view lhs, std::string_view rhs, CaseIndependent);
NAZARA_CORE_API bool StringEqual(std::string_view lhs, std::string_view rhs, UnicodeAware);
NAZARA_CORE_API bool StringEqual(std::string_view lhs, std::string_view rhs, CaseIndependent, UnicodeAware);
inline long long StringToNumber(const std::string_view& str, UInt8 radix = 10, bool* ok = nullptr);
inline long long StringToNumber(std::string_view str, UInt8 radix = 10, bool* ok = nullptr);
NAZARA_CORE_API std::string ToLower(const std::string_view& str);
NAZARA_CORE_API std::string ToLower(const std::string_view& str, UnicodeAware);
NAZARA_CORE_API std::string ToLower(std::string_view str);
NAZARA_CORE_API std::string ToLower(std::string_view str, UnicodeAware);
NAZARA_CORE_API std::string ToUpper(const std::string_view& str);
NAZARA_CORE_API std::string ToUpper(const std::string_view& str, UnicodeAware);
NAZARA_CORE_API std::string ToUpper(std::string_view str);
NAZARA_CORE_API std::string ToUpper(std::string_view str, UnicodeAware);
NAZARA_CORE_API std::u16string ToUtf16String(const std::string_view& str);
NAZARA_CORE_API std::u32string ToUtf32String(const std::string_view& str);
NAZARA_CORE_API std::wstring ToWideString(const std::string_view& str);
NAZARA_CORE_API std::u16string ToUtf16String(std::string_view str);
NAZARA_CORE_API std::u32string ToUtf32String(std::string_view str);
NAZARA_CORE_API std::wstring ToWideString(std::string_view str);
inline std::string_view Trim(std::string_view str);
inline std::string_view Trim(std::string_view str, char c);