Wed, 17 Jul 2013 18:59:28 +0300
updated .gitignore
0 | 1 | #include <QObject> |
2 | #include <QStringList> | |
3 | #include <QTextStream> | |
4 | #include <assert.h> | |
5 | #include "types.h" | |
6 | ||
1 | 7 | str doFormat( initlist<StringFormatArg> args ) { |
0 | 8 | assert( args.size() >= 1 ); |
1 | 9 | str text = args.begin()->value(); |
0 | 10 | |
1 | 11 | for( initlist<StringFormatArg>::iterator it = args.begin() + 1; it != args.end(); ++it ) |
12 | text = text.arg( it->value() ); | |
0 | 13 | |
14 | return text; | |
15 | } | |
16 | ||
6
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
17 | void doPrint( FILE* fp, initlist<StringFormatArg> args ) { |
67b6ef6917ba
Now capable of actually launching demos
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1
diff
changeset
|
18 | fprintf( fp, "%s", doFormat( args ).toStdString().c_str() ); |
0 | 19 | } |
20 | ||
21 | // ============================================================================= | |
22 | StringFormatArg::StringFormatArg( const str& v ) { m_val = v; } | |
23 | StringFormatArg::StringFormatArg( const char& v ) { m_val = v; } | |
24 | StringFormatArg::StringFormatArg( const uchar& v ) { m_val = v; } | |
25 | StringFormatArg::StringFormatArg( const qchar& v ) { m_val = v; } | |
26 | StringFormatArg::StringFormatArg( const float& v ) { m_val = str::number( v ); } | |
27 | StringFormatArg::StringFormatArg( const double& v ) { m_val = str::number( v ); } | |
28 | StringFormatArg::StringFormatArg( const char* v ) { m_val = v; } | |
29 | StringFormatArg::StringFormatArg( const void* v ) { m_val.sprintf( "%p", v ); } |