11 #pragma warning(disable:4996) 35 bool force_sign =
false;
41 char padchar = (*fmt ==
'0') ?
'0' :
' ';
43 while(*fmt>=
'0' && *fmt<=
'9')
45 pad = pad * 10 + (*fmt -
'0');
49 if (*fmt==
's' || *fmt==
'S')
51 const char * ptr = va_arg(list,
const char*);
53 if (pad>len) out.
add_chars(padchar,pad-len);
58 else if (*fmt==
'i' || *fmt==
'I' || *fmt==
'd' || *fmt==
'D')
60 int val = va_arg(list,
int);
61 if (force_sign && val>0) out.
add_char(
'+');
64 if (pad>len) out.
add_chars(padchar,pad-len);
68 else if (*fmt==
'u' || *fmt==
'U')
70 int val = va_arg(list,
int);
71 if (force_sign && val>0) out.
add_char(
'+');
74 if (pad>len) out.
add_chars(padchar,pad-len);
78 else if (*fmt==
'x' || *fmt==
'X')
80 int val = va_arg(list,
int);
81 if (force_sign && val>0) out.
add_char(
'+');
85 char * t =
const_cast< char*
> ( temp.
get_ptr() );
88 if (*t>=
'a' && *t<=
'z')
94 if (pad>len) out.
add_chars(padchar,pad-len);
98 else if (*fmt==
'c' || *fmt==
'C')
void add_chars(t_uint32 p_char, t_size p_count)
virtual void add_string(const char *p_string, t_size p_length=~0)=0
void run(const char *fmt, va_list list)
string_printf(const char *fmt,...)
void add_char(t_uint32 c)
static void g_run(string_base &out, const char *fmt, va_list list)
string_printf_va(const char *fmt, va_list list)