root/trunk/dep/include/g3dlite/G3D/format.h

Revision 2, 1.2 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/**
2 @file format.h
3 
4 @maintainer Morgan McGuire, matrix@graphics3d.com
5 
6 @author  2000-09-09
7 @edited  2005-11-03
8
9 Copyright 2000-2005, Morgan McGuire.
10 All rights reserved.
11 */
12
13#ifndef G3D_FORMAT_H
14#define G3D_FORMAT_H
15
16#include "G3D/platform.h"
17#include <string>
18#include <stdio.h>
19#include <cstdarg>
20#include <assert.h>
21#ifndef G3D_WIN32
22    // Don't include varargs.h for some random
23    // gcc reason
24    //#include <varargs.h>
25    #include <stdarg.h>
26#endif
27
28#ifndef _MSC_VER
29    #ifndef __cdecl
30        #define __cdecl __attribute__((cdecl))
31    #endif
32#endif
33
34namespace G3D {
35
36/**
37  Produces a string from arguments of the style of printf.  This avoids
38  problems with buffer overflows when using sprintf and makes it easy
39  to use the result functionally.  This function is fast when the resulting
40  string is under 160 characters (not including terminator) and slower
41  when the string is longer.
42 */
43std::string format(
44    const char*                 fmt
45    ...) G3D_CHECK_PRINTF_ARGS;
46
47/**
48  Like format, but can be called with the argument list from a ... function.
49 */
50std::string vformat(
51    const char*                 fmt,
52    va_list                     argPtr) G3D_CHECK_VPRINTF_ARGS;
53
54
55}; // namespace
56
57#endif
Note: See TracBrowser for help on using the browser.