mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Add more printflike macros.
This commit is contained in:
parent
a6617e6297
commit
fb7a8886f1
|
@ -23,7 +23,7 @@ public:
|
||||||
virtual void SetProgressValue(u32 value) = 0;
|
virtual void SetProgressValue(u32 value) = 0;
|
||||||
virtual void IncrementProgressValue() = 0;
|
virtual void IncrementProgressValue() = 0;
|
||||||
|
|
||||||
void SetFormattedStatusText(const char* Format, ...);
|
void SetFormattedStatusText(const char* Format, ...) printflike(2, 3);
|
||||||
|
|
||||||
virtual void DisplayError(const char* message) = 0;
|
virtual void DisplayError(const char* message) = 0;
|
||||||
virtual void DisplayWarning(const char* message) = 0;
|
virtual void DisplayWarning(const char* message) = 0;
|
||||||
|
@ -34,13 +34,13 @@ public:
|
||||||
virtual bool ModalConfirmation(const char* message) = 0;
|
virtual bool ModalConfirmation(const char* message) = 0;
|
||||||
virtual void ModalInformation(const char* message) = 0;
|
virtual void ModalInformation(const char* message) = 0;
|
||||||
|
|
||||||
void DisplayFormattedError(const char* format, ...);
|
void DisplayFormattedError(const char* format, ...) printflike(2, 3);
|
||||||
void DisplayFormattedWarning(const char* format, ...);
|
void DisplayFormattedWarning(const char* format, ...) printflike(2, 3);
|
||||||
void DisplayFormattedInformation(const char* format, ...);
|
void DisplayFormattedInformation(const char* format, ...) printflike(2, 3);
|
||||||
void DisplayFormattedDebugMessage(const char* format, ...);
|
void DisplayFormattedDebugMessage(const char* format, ...) printflike(2, 3);
|
||||||
void DisplayFormattedModalError(const char* format, ...);
|
void DisplayFormattedModalError(const char* format, ...) printflike(2, 3);
|
||||||
bool DisplayFormattedModalConfirmation(const char* format, ...);
|
bool DisplayFormattedModalConfirmation(const char* format, ...) printflike(2, 3);
|
||||||
void DisplayFormattedModalInformation(const char* format, ...);
|
void DisplayFormattedModalInformation(const char* format, ...) printflike(2, 3);
|
||||||
|
|
||||||
void UpdateProgressFromStream(ByteStream* stream);
|
void UpdateProgressFromStream(ByteStream* stream);
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
void AppendSubString(const char* appendText, s32 Offset = 0, s32 Count = std::numeric_limits<s32>::max());
|
void AppendSubString(const char* appendText, s32 Offset = 0, s32 Count = std::numeric_limits<s32>::max());
|
||||||
|
|
||||||
// append formatted string to this string
|
// append formatted string to this string
|
||||||
void AppendFormattedString(const char* FormatString, ...);
|
void AppendFormattedString(const char* FormatString, ...) printflike(2, 3);
|
||||||
void AppendFormattedStringVA(const char* FormatString, va_list ArgPtr);
|
void AppendFormattedStringVA(const char* FormatString, va_list ArgPtr);
|
||||||
|
|
||||||
// append a single character to this string
|
// append a single character to this string
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
void PrependSubString(const char* appendText, s32 Offset = 0, s32 Count = std::numeric_limits<s32>::max());
|
void PrependSubString(const char* appendText, s32 Offset = 0, s32 Count = std::numeric_limits<s32>::max());
|
||||||
|
|
||||||
// append formatted string to this string
|
// append formatted string to this string
|
||||||
void PrependFormattedString(const char* FormatString, ...);
|
void PrependFormattedString(const char* FormatString, ...) printflike(2, 3);
|
||||||
void PrependFormattedStringVA(const char* FormatString, va_list ArgPtr);
|
void PrependFormattedStringVA(const char* FormatString, va_list ArgPtr);
|
||||||
|
|
||||||
// insert a string at the specified offset
|
// insert a string at the specified offset
|
||||||
|
@ -133,7 +133,7 @@ public:
|
||||||
void InsertString(s32 offset, const std::string_view& appendStr);
|
void InsertString(s32 offset, const std::string_view& appendStr);
|
||||||
|
|
||||||
// set to formatted string
|
// set to formatted string
|
||||||
void Format(const char* FormatString, ...);
|
void Format(const char* FormatString, ...) printflike(2, 3);
|
||||||
void FormatVA(const char* FormatString, va_list ArgPtr);
|
void FormatVA(const char* FormatString, va_list ArgPtr);
|
||||||
|
|
||||||
// compare one string to another
|
// compare one string to another
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates a new string from the specified format
|
// creates a new string from the specified format
|
||||||
static String FromFormat(const char* FormatString, ...);
|
static String FromFormat(const char* FormatString, ...) printflike(1, 2);
|
||||||
|
|
||||||
// accessor operators
|
// accessor operators
|
||||||
// const char &operator[](u32 i) const { DebugAssert(i < m_pStringData->StringLength); return
|
// const char &operator[](u32 i) const { DebugAssert(i < m_pStringData->StringLength); return
|
||||||
|
@ -345,7 +345,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the fromstring method
|
// Override the fromstring method
|
||||||
static StackString FromFormat(const char* FormatString, ...)
|
static StackString FromFormat(const char* FormatString, ...) printflike(1, 2)
|
||||||
{
|
{
|
||||||
va_list argPtr;
|
va_list argPtr;
|
||||||
va_start(argPtr, FormatString);
|
va_start(argPtr, FormatString);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
namespace StringUtil {
|
namespace StringUtil {
|
||||||
|
|
||||||
/// Constructs a std::string from a format string.
|
/// Constructs a std::string from a format string.
|
||||||
std::string StdStringFromFormat(const char* format, ...);
|
std::string StdStringFromFormat(const char* format, ...) printflike(1, 2);
|
||||||
std::string StdStringFromFormatV(const char* format, std::va_list ap);
|
std::string StdStringFromFormatV(const char* format, std::va_list ap);
|
||||||
|
|
||||||
/// Checks if a wildcard matches a search string.
|
/// Checks if a wildcard matches a search string.
|
||||||
|
|
|
@ -74,7 +74,7 @@ VkShaderModule CompileAndCreateFragmentShader(std::string_view source_code);
|
||||||
VkShaderModule CompileAndCreateComputeShader(std::string_view source_code);
|
VkShaderModule CompileAndCreateComputeShader(std::string_view source_code);
|
||||||
|
|
||||||
const char* VkResultToString(VkResult res);
|
const char* VkResultToString(VkResult res);
|
||||||
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...);
|
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...) printflike(4, 5);
|
||||||
|
|
||||||
#define LOG_VULKAN_ERROR(res, ...) ::Vulkan::Util::LogVulkanResult(1, __func__, res, __VA_ARGS__)
|
#define LOG_VULKAN_ERROR(res, ...) ::Vulkan::Util::LogVulkanResult(1, __func__, res, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ void DisassembleAndLog(u32 addr);
|
||||||
void DisassembleAndPrint(u32 addr, u32 instructions_before, u32 instructions_after);
|
void DisassembleAndPrint(u32 addr, u32 instructions_before, u32 instructions_after);
|
||||||
|
|
||||||
// Write to CPU execution log file.
|
// Write to CPU execution log file.
|
||||||
void WriteToExecutionLog(const char* format, ...);
|
void WriteToExecutionLog(const char* format, ...) printflike(1, 2);
|
||||||
|
|
||||||
// Trace Routines
|
// Trace Routines
|
||||||
bool IsTraceEnabled();
|
bool IsTraceEnabled();
|
||||||
|
|
|
@ -64,23 +64,23 @@ public:
|
||||||
virtual void ReportDebuggerMessage(const char* message);
|
virtual void ReportDebuggerMessage(const char* message);
|
||||||
virtual bool ConfirmMessage(const char* message);
|
virtual bool ConfirmMessage(const char* message);
|
||||||
|
|
||||||
void ReportFormattedError(const char* format, ...);
|
void ReportFormattedError(const char* format, ...) printflike(2, 3);
|
||||||
void ReportFormattedMessage(const char* format, ...);
|
void ReportFormattedMessage(const char* format, ...) printflike(2, 3);
|
||||||
void ReportFormattedDebuggerMessage(const char* format, ...);
|
void ReportFormattedDebuggerMessage(const char* format, ...) printflike(2, 3);
|
||||||
bool ConfirmFormattedMessage(const char* format, ...);
|
bool ConfirmFormattedMessage(const char* format, ...) printflike(2, 3);
|
||||||
|
|
||||||
/// Adds OSD messages, duration is in seconds.
|
/// Adds OSD messages, duration is in seconds.
|
||||||
virtual void AddOSDMessage(std::string message, float duration = 2.0f);
|
virtual void AddOSDMessage(std::string message, float duration = 2.0f);
|
||||||
void AddFormattedOSDMessage(float duration, const char* format, ...);
|
void AddFormattedOSDMessage(float duration, const char* format, ...) printflike(3, 4);
|
||||||
|
|
||||||
/// Returns the base user directory path.
|
/// Returns the base user directory path.
|
||||||
ALWAYS_INLINE const std::string& GetUserDirectory() const { return m_user_directory; }
|
ALWAYS_INLINE const std::string& GetUserDirectory() const { return m_user_directory; }
|
||||||
|
|
||||||
/// Returns a path relative to the user directory.
|
/// Returns a path relative to the user directory.
|
||||||
std::string GetUserDirectoryRelativePath(const char* format, ...) const;
|
std::string GetUserDirectoryRelativePath(const char* format, ...) const printflike(2, 3);
|
||||||
|
|
||||||
/// Returns a path relative to the application directory (for system files).
|
/// Returns a path relative to the application directory (for system files).
|
||||||
std::string GetProgramDirectoryRelativePath(const char* format, ...) const;
|
std::string GetProgramDirectoryRelativePath(const char* format, ...) const printflike(2, 3);
|
||||||
|
|
||||||
/// Returns a string which can be used as part of a filename, based on the current date/time.
|
/// Returns a string which can be used as part of a filename, based on the current date/time.
|
||||||
static TinyString GetTimestampStringForFileName();
|
static TinyString GetTimestampStringForFileName();
|
||||||
|
|
|
@ -85,6 +85,7 @@ static ALWAYS_INLINE CommonHostInterface* GetHostInterface()
|
||||||
return static_cast<CommonHostInterface*>(g_host_interface);
|
return static_cast<CommonHostInterface*>(g_host_interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FormattedError(const char* format, ...) printflike(2, 3);
|
||||||
static void FormattedError(const char* format, ...)
|
static void FormattedError(const char* format, ...)
|
||||||
{
|
{
|
||||||
std::va_list ap;
|
std::va_list ap;
|
||||||
|
|
Loading…
Reference in a new issue