1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 #ifndef SLUDGE_NEWFATAL_H
23 #define SLUDGE_NEWFATAL_H
24 
25 #include "common/str.h"
26 #include "common/singleton.h"
27 
28 namespace Sludge {
29 
30 class FatalMsgManager : public Common::Singleton<Sludge::FatalMsgManager>{
31 public:
32 	FatalMsgManager();
33 	~FatalMsgManager() override;
34 
35 	void reset();
36 
37 	bool hasFatal();
38 	int fatal(const Common::String &str);
39 	void setFatalInfo(const Common::String &userFunc, const Common::String &BIF);
40 	void setResourceForFatal(int n);
41 
42 private:
43 	Common::String _fatalMessage;
44 	Common::String _fatalInfo;
45 
46 	int _resourceForFatal;
47 };
48 
hasFatal()49 inline bool hasFatal() {
50 	return FatalMsgManager::instance().hasFatal();
51 }
52 
fatal(const Common::String & str)53 inline int fatal(const Common::String &str) {
54 	return FatalMsgManager::instance().fatal(str);
55 }
56 
setFatalInfo(const Common::String & userFunc,const Common::String & BIF)57 inline void setFatalInfo(const Common::String &userFunc, const Common::String &BIF) {
58 	FatalMsgManager::instance().setFatalInfo(userFunc, BIF);
59 }
60 
setResourceForFatal(int n)61 inline void setResourceForFatal(int n) {
62 	FatalMsgManager::instance().setResourceForFatal(n);
63 }
64 
65 int checkNew(const void *mem);
66 int fatal(const Common::String &str1, const Common::String &str2);
67 
68 } // End of namespace Sludge
69 
70 #endif
71