]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/ireference.h
Merge remote-tracking branch 'github/master'
[xonotic/netradiant.git] / include / ireference.h
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant 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 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant 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 GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #if !defined( INCLUDED_IREFERENCE_H )
23 #define INCLUDED_IREFERENCE_H
24
25 #include "generic/constant.h"
26
27 namespace scene
28 {
29 class Node;
30 }
31
32 class ModuleObserver;
33
34 class Resource
35 {
36 public:
37 virtual bool load() = 0;
38 virtual bool save() = 0;
39 virtual void flush() = 0;
40 virtual void refresh() = 0;
41 virtual scene::Node* getNode() = 0;
42 virtual void setNode( scene::Node* node ) = 0;
43 virtual void attach( ModuleObserver& observer ) = 0;
44 virtual void detach( ModuleObserver& observer ) = 0;
45 virtual void realise() = 0;
46 virtual void unrealise() = 0;
47 };
48
49 class EntityCreator;
50
51 class ReferenceCache
52 {
53 public:
54 INTEGER_CONSTANT( Version, 1 );
55 STRING_CONSTANT( Name, "reference" );
56
57 virtual Resource* capture( const char* path ) = 0;
58 virtual void release( const char* path ) = 0;
59
60 virtual void setEntityCreator( EntityCreator& entityCreator ) = 0;
61 };
62
63 #include "modulesystem.h"
64
65 template<typename Type>
66 class GlobalModule;
67 typedef GlobalModule<ReferenceCache> GlobalReferenceModule;
68
69 template<typename Type>
70 class GlobalModuleRef;
71 typedef GlobalModuleRef<ReferenceCache> GlobalReferenceModuleRef;
72
73 inline ReferenceCache& GlobalReferenceCache(){
74         return GlobalReferenceModule::getTable();
75 }
76
77 #endif