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