#include <string_base.h>
Definition at line 466 of file string_base.h.
pfc::string_printf::string_printf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
|
explicit |
Definition at line 112 of file printf.cpp.
void run(const char *fmt, va_list list)
void pfc::string_printf::g_run |
( |
string_base & |
out, |
|
|
const char * |
fmt, |
|
|
va_list |
list |
|
) |
| |
|
static |
Definition at line 20 of file printf.cpp.
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')
100 out.add_char(va_arg(list,
int));
107 out.add_char(*(fmt++));
void pfc::string_printf::run |
( |
const char * |
fmt, |
|
|
va_list |
list |
|
) |
| |
Definition at line 16 of file printf.cpp.
16 {
g_run(*
this,fmt,list);}
static void g_run(string_base &out, const char *fmt, va_list list)
The documentation for this class was generated from the following files: