/* */ #include "StringFormat.h" #include #include #include #include #include namespace aria2 { StringFormat::StringFormat(const char* fmt, ...) { va_list ap; va_start(ap, fmt); char* strp; if(vasprintf(&strp, fmt, ap) != -1) { _msg.assign(&strp[0], &strp[strlen(strp)]); free(strp); } 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