Added a Printf() function that returns a new AString by value.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1041 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
76ab9fc0a8
commit
9f4b6ffc6c
@ -57,7 +57,7 @@ AString & AppendVPrintf(AString & str, const char *format, va_list args)
|
||||
|
||||
|
||||
|
||||
AString & Printf(AString & str, const char *format, ...)
|
||||
AString & Printf(AString & str, const char * format, ...)
|
||||
{
|
||||
str.clear();
|
||||
va_list args;
|
||||
@ -71,6 +71,20 @@ AString & Printf(AString & str, const char *format, ...)
|
||||
|
||||
|
||||
|
||||
AString Printf(const char * format, ...)
|
||||
{
|
||||
AString res;
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
AppendVPrintf(res, format, args);
|
||||
va_end(args);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AString & AppendPrintf(AString &str, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -27,6 +27,9 @@ extern AString & AppendVPrintf(AString & str, const char * format, va_list args)
|
||||
/// Output the formatted text into the string
|
||||
extern AString & Printf (AString & str, const char * format, ...);
|
||||
|
||||
/// Output the formatted text into string, return string by value
|
||||
extern AString Printf(const char * format, ...);
|
||||
|
||||
/// Add the formatted string to the existing data in the string
|
||||
extern AString & AppendPrintf (AString & str, const char * format, ...);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user