Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pantheios/util/string/snprintf.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        pantheios/util/string/snprintf.h (was pantheios/util/string/string.h)
00003  *
00004  * Purpose:     snprintf() utility functions.
00005  *
00006  * Created:     21st June 2005
00007  * Updated:     16th November 2010
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2005-2010, Matthew Wilson and Synesis Software
00012  * Copyright (c) 1999-2005, Synesis Software and Matthew Wilson
00013  * All rights reserved.
00014  *
00015  * Redistribution and use in source and binary forms, with or without
00016  * modification, are permitted provided that the following conditions are
00017  * met:
00018  *
00019  * - Redistributions of source code must retain the above copyright notice,
00020  *   this list of conditions and the following disclaimer.
00021  * - Redistributions in binary form must reproduce the above copyright
00022  *   notice, this list of conditions and the following disclaimer in the
00023  *   documentation and/or other materials provided with the distribution.
00024  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00025  *   names of any contributors may be used to endorse or promote products
00026  *   derived from this software without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00029  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00030  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00031  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00032  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00033  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00034  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00035  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00036  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00037  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00038  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  * ////////////////////////////////////////////////////////////////////// */
00041 
00042 
00048 #ifndef PANTHEIOS_INCL_PANTHEIOS_UTIL_STRING_H_SNPRINTF
00049 #define PANTHEIOS_INCL_PANTHEIOS_UTIL_STRING_H_SNPRINTF
00050 
00051 /* /////////////////////////////////////////////////////////////////////////
00052  * Version information
00053  */
00054 
00055 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00056 # define PANTHEIOS_VER_PANTHEIOS_UTIL_STRING_H_SNPRINTF_MAJOR       2
00057 # define PANTHEIOS_VER_PANTHEIOS_UTIL_STRING_H_SNPRINTF_MINOR       2
00058 # define PANTHEIOS_VER_PANTHEIOS_UTIL_STRING_H_SNPRINTF_REVISION    3
00059 # define PANTHEIOS_VER_PANTHEIOS_UTIL_STRING_H_SNPRINTF_EDIT        19
00060 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00061 
00062 /* /////////////////////////////////////////////////////////////////////////
00063  * Includes
00064  */
00065 
00066 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00067 # include <pantheios/pantheios.h>
00068 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
00069 
00070 #ifndef PANTHEIOS_INCL_H_STDARG
00071 # define PANTHEIOS_INCL_H_STDARG
00072 # include <stdarg.h>
00073 #endif /* !PANTHEIOS_INCL_H_STDARG */
00074 
00075 /* /////////////////////////////////////////////////////////////////////////
00076  * API
00077  */
00078 
00079 #if !defined(PANTHEIOS_NO_NAMESPACE)
00080 namespace pantheios
00081 {
00082 #endif /* !PANTHEIOS_NO_NAMESPACE */
00083 
00084 /* /////////////////////////////////////////////////////////////////////////
00085  * API
00086  */
00087 
00099 PANTHEIOS_CALL(int) pantheios_util_snprintf(
00100     pan_char_t*         dest
00101 ,   size_t              cchDest
00102 ,   const pan_char_t*   fmt
00103 ,   ...
00104 )
00105 #if defined(STLSOFT_COMPILER_IS_GCC) /* TODO: Change this to proper discriminated feature */
00106 __attribute__((format(printf,3,4)))
00107 #endif /* compiler */
00108 ;
00109 
00122 PANTHEIOS_CALL(int) pantheios_util_vsnprintf(pan_char_t* dest, size_t cchDest, pan_char_t const* fmt, va_list args);
00123 
00124 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00125 PANTHEIOS_CALL(int) pantheios_util_snprintf_a(char* dest, size_t cchDest, const char* fmt, ...);
00126 PANTHEIOS_CALL(int) pantheios_util_vsnprintf_a(char* dest, size_t cchDest, char const* fmt, va_list args);
00127 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00128 
00129 /* /////////////////////////////////////////////////////////////////////////
00130  * Namespace
00131  */
00132 
00133 #if !defined(PANTHEIOS_NO_NAMESPACE)
00134 } /* namespace pantheios */
00135 #endif /* !PANTHEIOS_NO_NAMESPACE */
00136 
00137 /* /////////////////////////////////////////////////////////////////////////
00138  * Inclusion
00139  */
00140 
00141 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
00142 # pragma once
00143 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
00144 
00145 /* ////////////////////////////////////////////////////////////////////// */
00146 
00147 #endif /* !PANTHEIOS_INCL_PANTHEIOS_UTIL_STRING_H_SNPRINTF */
00148 
00149 /* ///////////////////////////// end of file //////////////////////////// */

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo