Fix includes script.
[UnsignedByte.git] / src / Resource / Global.h
blob1fdb95498dbf584aa3e1bfb7ab8b6e22ff6a56dd
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);
55 * Logging
56 */
59 /** Prints the specified raw msg. */
60 void printraw(const std::string& msg);
62 /** Prints the specified mode msg. */
63 void printmode(const std::string& msg);
65 /** Prints the specified bug msg. */
66 void printbug(const std::string& msg);
68 /** Prints the specified exception msg. */
69 void printexception(const std::string& msg);
71 /** Prints the specified exception msg. */
72 void printexception(const std::string& msg, const std::string& what);
74 /** Prints the specified sql msg. */
75 void printsql(const std::string& msg);
77 /** Prints the specified status msg. */
78 void printstatus(const std::string& msg);
80 /** Prints the specified log msg. */
81 void printlog(const std::string& msg);
83 private:
84 /** This is a singleton class, use <code>Get</code> to retreive the instance. */
85 Global(void);
87 /** This is a singleton class, use <code>Free</code> to free the instance. */
88 ~Global(void);
90 friend class Singleton<Global>;
92 char m_workspace[MAXSIZE]; /**< The workspace to use when using sprintf/bugf/logf. */