ScummVM API documentation
ResourceBase.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_RESOURCEBASE_H
29#define HPL_RESOURCEBASE_H
30
31#include "hpl1/engine/system/SystemTypes.h"
32#include "hpl1/engine/system/low_level_system.h"
33
34namespace hpl {
35
37public:
38 iResourceBase(tString asName, unsigned long alPrio);
39
40 virtual ~iResourceBase();
41
46 virtual bool reload() = 0;
47
51 virtual void unload() = 0;
52
56 virtual void destroy() = 0;
57
58 tString GetName() { return msName; }
59 unsigned long GetHandle() { return mlHandle; }
60 void SetHandle(unsigned long alHandle) { mlHandle = alHandle; }
61 tString GetFilePath() { return msFilePath; }
62 unsigned long GetTime() { return mlTime; }
63 unsigned long GetPrio() { return mlPrio; }
64 unsigned long GetSize() { return mlSize; }
65
66 void SetLogDestruction(bool abX) { mbLogDestruction = abX; }
67
68 unsigned int GetUserCount() { return mlUserCount; }
69 void IncUserCount();
70 void DecUserCount() {
71 if (mlUserCount > 0)
72 mlUserCount--;
73 }
74 bool HasUsers() { return mlUserCount > 0; }
75
76 static bool GetLogCreateAndDelete() { return mbLogCreateAndDelete; }
77 static void SetLogCreateAndDelete(bool abX) { mbLogCreateAndDelete = abX; }
78
79protected:
80 static bool mbLogCreateAndDelete;
81
82 unsigned int mlPrio; // dunno if this will be of any use.
83 unsigned long mlTime; // Time for creation.
84 unsigned long mlSize; // for completion. Not used yet.
85
86 unsigned int mlUserCount;
87 unsigned long mlHandle;
88 tString msName;
89 tString msFilePath;
90 bool mbLogDestruction;
91};
92
93} // namespace hpl
94
95#endif // HPL_RESOURCEBASE_H
Definition: str.h:59
Definition: ResourceBase.h:36
virtual void unload()=0
virtual bool reload()=0
virtual void destroy()=0