/* */ #include "StringFormat.h" #include #include #include #include #include namespace aria2 { StringFormat::StringFormat(const char* fmt, ...) { va_list ap; va_start(ap, fmt); char buf[1024]; int r; if((r = vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { _msg.assign(&buf[0], &buf[r]); } va_end(ap); } const std::string& StringFormat::str() const { return _msg; } std::ostream& operator<<(std::ostream& o, const StringFormat& fmt) { o << fmt.str(); return o; } } // namespace aria2