From 8f9a5b76761885e908df60af1d0a9d3146b7689c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 25 Aug 2009 15:25:56 +0200 Subject: move to_string() helper to abrtlib.h Signed-off-by: Denys Vlasenko --- inc/abrtlib.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/abrtlib.h b/inc/abrtlib.h index 5cde2cb9..1cac10c0 100644 --- a/inc/abrtlib.h +++ b/inc/abrtlib.h @@ -38,6 +38,8 @@ #include /* C++ bits */ #include +#include +#include /* Some libc's forget to declare these, do it ourself */ extern char **environ; @@ -106,7 +108,6 @@ void xstat(const char *name, struct stat *stat_buf); void xmove_fd(int from, int to); char* xasprintf(const char *format, ...); -std::string ssprintf(const char *format, ...); int xopen(const char *pathname, int flags); int xopen3(const char *pathname, int flags, int mode); @@ -116,6 +117,18 @@ off_t copyfd_eof(int src_fd, int dst_fd); off_t copyfd_size(int src_fd, int dst_fd, off_t size); void copyfd_exact_size(int src_fd, int dst_fd, off_t size); +/* C++ style stuff */ + +std::string ssprintf(const char *format, ...); std::string get_home_dir(int uid); +template +std::string +to_string( T x ) +{ + std::ostringstream o; + o << x; + return o.str(); +} + #endif -- cgit