SmallString: fmt -> format, format -> sprintf
This commit is contained in:
@ -58,11 +58,11 @@ public:
|
||||
void append(const SmallStringBase& str);
|
||||
|
||||
// append formatted string to this string
|
||||
void append_format(const char* format, ...) printflike(2, 3);
|
||||
void append_format_va(const char* format, va_list ap);
|
||||
void append_sprintf(const char* format, ...) printflike(2, 3);
|
||||
void append_vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void append_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void append_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// append hex string
|
||||
void append_hex(const void* data, size_t len);
|
||||
@ -78,11 +78,11 @@ public:
|
||||
void prepend(const SmallStringBase& str);
|
||||
|
||||
// append formatted string to this string
|
||||
void prepend_format(const char* format, ...) printflike(2, 3);
|
||||
void prepend_format_va(const char* format, va_list ap);
|
||||
void prepend_sprintf(const char* format, ...) printflike(2, 3);
|
||||
void prepend_vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void prepend_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void prepend_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// insert a string at the specified offset
|
||||
void insert(s32 offset, const char* str);
|
||||
@ -92,11 +92,11 @@ public:
|
||||
void insert(s32 offset, const SmallStringBase& str);
|
||||
|
||||
// set to formatted string
|
||||
void format(const char* format, ...) printflike(2, 3);
|
||||
void format_va(const char* format, va_list ap);
|
||||
void sprintf(const char* format, ...) printflike(2, 3);
|
||||
void vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// compare one string to another
|
||||
bool equals(const char* str) const;
|
||||
@ -298,10 +298,10 @@ public:
|
||||
}
|
||||
|
||||
// Override the fromstring method
|
||||
static SmallStackString from_format(const char* format, ...) printflike(1, 2);
|
||||
static SmallStackString from_sprintf(const char* format, ...) printflike(1, 2);
|
||||
|
||||
template<typename... T>
|
||||
static SmallStackString from_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
static SmallStackString from_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
private:
|
||||
char m_stack_buffer[L + 1];
|
||||
@ -325,13 +325,13 @@ private:
|
||||
#endif
|
||||
|
||||
template<u32 L>
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(const char* format, ...)
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_sprintf(const char* format, ...)
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
SmallStackString ret;
|
||||
ret.format_va(format, ap);
|
||||
ret.vsprintf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
@ -340,7 +340,7 @@ ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(const char* f
|
||||
|
||||
template<u32 L>
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
SmallStackString<L> ret;
|
||||
fmt::vformat_to(std::back_inserter(ret), fmt, fmt::make_format_args(args...));
|
||||
@ -353,13 +353,13 @@ using SmallString = SmallStackString<256>;
|
||||
using LargeString = SmallStackString<512>;
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::append_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::append_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
fmt::vformat_to(std::back_inserter(*this), fmt, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::prepend_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::prepend_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
TinyString str;
|
||||
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
|
||||
@ -367,7 +367,7 @@ ALWAYS_INLINE void SmallStringBase::prepend_fmt(fmt::format_string<T...> fmt, T&
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
clear();
|
||||
fmt::vformat_to(std::back_inserter(*this), fmt, fmt::make_format_args(args...));
|
||||
|
||||
Reference in New Issue
Block a user