00001 #ifndef STRINGF_H
00002 #define STRINGF_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <string>
00025
00026 #ifndef ATTR_PRINTF
00027 #ifdef GCC
00028 #define ATTR_PRINTF(string, first) __attribute__((format (printf, string, first)))
00029 #else
00030 #define ATTR_PRINTF(string, first)
00031 #endif
00032 #endif
00033
00034 namespace stringf
00035 {
00037 int addf(std::string& str, const char* fmt, ...) throw() ATTR_PRINTF(2, 3);
00038
00040 std::string fmt(const char* fmt, ...) throw() ATTR_PRINTF(1, 2);
00041
00042 std::string fmt(int val) throw ();
00043 std::string fmt(unsigned int val) throw ();
00044 std::string fmt(long int val) throw ();
00045 std::string fmt(long unsigned int val) throw ();
00046
00047 inline std::string fmt(const std::string& str) throw () { return str; }
00048 };
00049
00051 #define PFSTR(str) (int)(str).size(), (str).data()
00052
00053
00054 #endif