Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

stringf.h

Go to the documentation of this file.
00001 #ifndef STRINGF_H 00002 #define STRINGF_H 00003 00004 #pragma interface 00005 00006 /* 00007 * Generic std::string helpers 00008 * 00009 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 // Useful only in templates 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 // vim:set ts=4 sw=4: 00056 #endif

Generated on Sun Aug 15 21:20:49 2004 for libtagcoll by doxygen 1.3.8