00001 /** @file rutz/sfmt.h make a rutz::fstring using printf-style 00002 formatting */ 00003 00004 /////////////////////////////////////////////////////////////////////// 00005 // 00006 // Copyright (c) 2005-2007 University of Southern California 00007 // Rob Peters <rjpeters at klab dot caltech dot edu> 00008 // 00009 // created: Tue Jul 5 11:02:38 2005 00010 // commit: $Id: sfmt.h 8249 2007-04-12 06:03:40Z rjpeters $ 00011 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/sfmt.h $ 00012 // 00013 // -------------------------------------------------------------------- 00014 // 00015 // This file is part of GroovX. 00016 // [http://www.klab.caltech.edu/rjpeters/groovx/] 00017 // 00018 // GroovX is free software; you can redistribute it and/or modify it 00019 // under the terms of the GNU General Public License as published by 00020 // the Free Software Foundation; either version 2 of the License, or 00021 // (at your option) any later version. 00022 // 00023 // GroovX is distributed in the hope that it will be useful, but 00024 // WITHOUT ANY WARRANTY; without even the implied warranty of 00025 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00026 // General Public License for more details. 00027 // 00028 // You should have received a copy of the GNU General Public License 00029 // along with GroovX; if not, write to the Free Software Foundation, 00030 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00031 // 00032 /////////////////////////////////////////////////////////////////////// 00033 00034 #ifndef GROOVX_RUTZ_SFMT_H_UTC20050705180238_DEFINED 00035 #define GROOVX_RUTZ_SFMT_H_UTC20050705180238_DEFINED 00036 00037 #include "rutz/fstring.h" 00038 00039 #include <stdarg.h> 00040 00041 namespace rutz 00042 { 00043 //! snprintf() the specified format string + varargs into a rutz::fstring. 00044 /*! NOTE: The CALLER is responsible for doing va_end(ap); it is not 00045 done internally in vsfmt(). */ 00046 rutz::fstring vsfmt(const char* fmt, va_list ap); 00047 00048 //! snprintf() the specified format string + varargs into a rutz::fstring. 00049 rutz::fstring sfmt(const char* fmt, ...) 00050 // NOTE: this __attribute__ tells gcc that it should issue 00051 // printf-style warnings when compiling calls to sfmt(), treating 00052 // the 1st argument (fmt) as the format string, and the 2nd and 00053 // subsequent arguments as the printf-style parameters 00054 __attribute__((format(__printf__, 1, 2))); 00055 ; 00056 } 00057 00058 static const char __attribute__((used)) vcid_groovx_rutz_sfmt_h_utc20050705180238[] = "$Id: sfmt.h 8249 2007-04-12 06:03:40Z rjpeters $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/sfmt.h $"; 00059 #endif // !GROOVX_RUTZ_SFMT_H_UTC20050705180238DEFINED