Misc: Pass string_view by value
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
@ -27,45 +27,44 @@ std::optional<std::time_t> GetResourceFileTimestamp(std::string_view filename, b
|
||||
|
||||
/// Reports a fatal error on the main thread. This does not assume that the main window exists,
|
||||
/// unlike ReportErrorAsync(), and will exit the application after the popup is closed.
|
||||
void ReportFatalError(const std::string_view& title, const std::string_view& message);
|
||||
void ReportFatalError(std::string_view title, std::string_view message);
|
||||
|
||||
/// Displays an asynchronous error on the UI thread, i.e. doesn't block the caller.
|
||||
void ReportErrorAsync(const std::string_view& title, const std::string_view& message);
|
||||
void ReportFormattedErrorAsync(const std::string_view& title, const char* format, ...);
|
||||
void ReportErrorAsync(std::string_view title, std::string_view message);
|
||||
void ReportFormattedErrorAsync(std::string_view title, const char* format, ...);
|
||||
|
||||
/// Displays a synchronous confirmation on the UI thread, i.e. blocks the caller.
|
||||
bool ConfirmMessage(const std::string_view& title, const std::string_view& message);
|
||||
bool ConfirmFormattedMessage(const std::string_view& title, const char* format, ...);
|
||||
bool ConfirmMessage(std::string_view title, std::string_view message);
|
||||
bool ConfirmFormattedMessage(std::string_view title, const char* format, ...);
|
||||
|
||||
/// Returns the user agent to use for HTTP requests.
|
||||
std::string GetHTTPUserAgent();
|
||||
|
||||
/// Opens a URL, using the default application.
|
||||
void OpenURL(const std::string_view& url);
|
||||
void OpenURL(std::string_view url);
|
||||
|
||||
/// Copies the provided text to the host's clipboard, if present.
|
||||
bool CopyTextToClipboard(const std::string_view& text);
|
||||
bool CopyTextToClipboard(std::string_view text);
|
||||
|
||||
/// Returns a localized version of the specified string within the specified context.
|
||||
/// The pointer is guaranteed to be valid until the next language change.
|
||||
const char* TranslateToCString(const std::string_view& context, const std::string_view& msg);
|
||||
const char* TranslateToCString(std::string_view context, std::string_view msg);
|
||||
|
||||
/// Returns a localized version of the specified string within the specified context.
|
||||
/// The view is guaranteed to be valid until the next language change.
|
||||
/// NOTE: When passing this to fmt, positional arguments should be used in the base string, as
|
||||
/// not all locales follow the same word ordering.
|
||||
std::string_view TranslateToStringView(const std::string_view& context, const std::string_view& msg);
|
||||
std::string_view TranslateToStringView(std::string_view context, std::string_view msg);
|
||||
|
||||
/// Returns a localized version of the specified string within the specified context.
|
||||
std::string TranslateToString(const std::string_view& context, const std::string_view& msg);
|
||||
std::string TranslateToString(std::string_view context, std::string_view msg);
|
||||
|
||||
/// Clears the translation cache. All previously used strings should be considered invalid.
|
||||
void ClearTranslationCache();
|
||||
|
||||
namespace Internal {
|
||||
/// Implementation to retrieve a translated string.
|
||||
s32 GetTranslatedStringImpl(const std::string_view& context, const std::string_view& msg, char* tbuf,
|
||||
size_t tbuf_space);
|
||||
s32 GetTranslatedStringImpl(std::string_view context, std::string_view msg, char* tbuf, size_t tbuf_space);
|
||||
} // namespace Internal
|
||||
} // namespace Host
|
||||
|
||||
|
||||
Reference in New Issue
Block a user