00001 // ssprintf.h 00002 // 00003 // Copyright (C) 2005, 2007 Daniel Burrows 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License as 00007 // published by the Free Software Foundation; either version 2 of 00008 // the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; see the file COPYING. If not, write to 00017 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 // Boston, MA 02111-1307, USA. 00019 00020 #ifndef SSPRINTF_H 00021 #define SSPRINTF_H 00022 00023 #include <string> 00024 #include <cstdarg> 00025 #include <cstdio> 00026 00027 namespace cwidget 00028 { 00029 namespace util 00030 { 00031 00032 // Printf for std::string. 00033 #ifdef __GNUG__ 00034 __attribute__ ((format (printf, 1, 2))) 00035 #endif 00036 std::string ssprintf(const char *format, ...); 00037 std::string vssprintf(const char *format, va_list ap); 00038 00039 std::wstring swsprintf(const wchar_t *format, ...); 00040 00041 std::wstring vswsprintf(const wchar_t *format, va_list ap); 00042 00046 std::string sstrerror(int errnum); 00047 } 00048 } 00049 00050 #endif // SSPRINTF_H