--- a/sources/format.h Fri May 15 21:43:21 2015 +0300 +++ b/sources/format.h Tue May 26 11:41:58 2015 +0300 @@ -33,25 +33,22 @@ #include "basics.h" #include "geometry.h" -#define FORMAT_OVERLOAD(...) \ - inline String make_format_argument (__VA_ARGS__ a) - // ------------------------------------------------------------------------------------------------- // -FORMAT_OVERLOAD (String) { return a; } -FORMAT_OVERLOAD (char) { return String (a); } -FORMAT_OVERLOAD (short int) { return String::from_number (a); } -FORMAT_OVERLOAD (int) { return String::from_number (a); } -FORMAT_OVERLOAD (long int) { return String::from_number (a); } -FORMAT_OVERLOAD (double) { return String::from_number (a); } -FORMAT_OVERLOAD (unsigned short int) { return String::from_number (a); } -FORMAT_OVERLOAD (unsigned int) { return String::from_number (a); } -FORMAT_OVERLOAD (unsigned long int) { return String::from_number (a); } -FORMAT_OVERLOAD (const char*) { return a; } -FORMAT_OVERLOAD (std::nullptr_t) { (void) a; return "<null pointer>"; } -FORMAT_OVERLOAD (bool) { return a ? "true" : "false"; } +inline String make_format_argument (String a) { return a; } +inline String make_format_argument (char a) { return String (a); } +inline String make_format_argument (short a) { return String::from_number (a); } +inline String make_format_argument (int a) { return String::from_number (a); } +inline String make_format_argument (long a) { return String::from_number (a); } +inline String make_format_argument (double a) { return String::from_number (a); } +inline String make_format_argument (unsigned short a) { return String::from_number (a); } +inline String make_format_argument (unsigned int a) { return String::from_number (a); } +inline String make_format_argument (unsigned long a) { return String::from_number (a); } +inline String make_format_argument (const char* a) { return a; } +inline String make_format_argument (std::nullptr_t) { return "<null pointer>"; } +inline String make_format_argument (bool a) { return a ? "true" : "false"; } -FORMAT_OVERLOAD (const void*) +inline String make_format_argument (const void* a) { String result; result.sprintf ("%p", a); @@ -59,7 +56,7 @@ } template<typename T, typename C> -FORMAT_OVERLOAD (const Container<T, C>&) +inline String make_format_argument (const Container<T, C>& a) { String result; @@ -80,7 +77,7 @@ return result; } -FORMAT_OVERLOAD (Color) +inline String make_format_argument (Color a) { static const char* colorstrings[] = { @@ -97,17 +94,17 @@ return "???"; } -FORMAT_OVERLOAD (Position) +inline String make_format_argument (const Position& a) { return String ("(") + a.x + ", " + a.y + ")"; } -FORMAT_OVERLOAD (Size) +inline String make_format_argument (const Size& a) { return String ("(") + a.width + "x" + a.height + ")"; } -FORMAT_OVERLOAD (Rectangle) +inline String make_format_argument (const Rectangle& a) { String result; result.sprintf ("{(%d, %d), (%dx%d)}", a.x, a.y, a.width, a.height); @@ -118,7 +115,7 @@ // // Formats the given string with the given args. // -FUNCTION format_args (const String& fmtstr, const Vector<String>& args) -> String; +String format_args (const String& fmtstr, const Vector<String>& args); // ------------------------------------------------------------------------------------------------- //