We are working with signed long (made this explicit) so use fromLong instead of fromInt.
[UnsignedByte.git] / src / Resource / Global.h
blob7a6be39eb54d276f0add04d48a5f661a2939ef28
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20 #pragma once
22 /**
23 * @file Global.h
24 * This file contains the Global class.
26 * @see Global
27 */
29 #include "Types.h"
30 #include <stdarg.h>
32 /**
33 * This class is used to contain otherwise global variables and methods.
34 */
35 class Global : public Singleton<Global>
37 public:
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. */
45 char OOCIdentifier;
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, ...);
65 private:
66 /** This is a singleton class, use <code>Get</code> to retreive the instance. */
67 Global(void);
69 /** This is a singleton class, use <code>Free</code> to free the instance. */
70 ~Global(void);
72 friend class Singleton<Global>;
74 char m_workspace[MAXSIZE]; /**< The workspace to use when using sprintf/bugf/logf. */