1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 * This file contains the Global class.
33 * This class is used to contain otherwise global variables and methods.
35 class Global
: public Singleton
<Global
>
38 /** The maximum character buffer size. */
39 static const int MAXSIZE
= (1<<16);
41 /** The 'empty' string. */
42 std::string EmptyString
;
44 /** The character that identifies an OOC command. */
47 /** Returns the formatted data. */
48 std::string
sprintf(const char* format
, ...);
50 /** Returns the formatted data. */
51 std::string
sprint(va_list& args
, const char* format
);
53 /** Prints the data as a bug. */
54 void bug(const char* msg
);
56 /** Prints the formatted data as a bug. */
57 void bugf(const char* format
, ...);
59 /** Logs the data as a bug. */
60 void log(const char* msg
);
62 /** Logs the formatted data as a bug. */
63 void logf(const char* format
, ...);
66 /** This is a singleton class, use <code>Get</code> to retreive the instance. */
69 /** This is a singleton class, use <code>Free</code> to free the instance. */
72 friend class Singleton
<Global
>;
74 char m_workspace
[MAXSIZE
]; /**< The workspace to use when using sprintf/bugf/logf. */