Oxygine
1
2g game engine
oxygine
src
res
Resource.h
1
#pragma once
2
#include "oxygine-include.h"
3
#include <string>
4
#include "core/Object.h"
5
#include "pugixml/pugixml.hpp"
6
7
namespace
oxygine
8
{
9
DECLARE_SMART(Resource, spResource);
10
class
Resource
:
public
Object
11
{
12
INHERITED(
Object
);
13
public
:
14
Resource
();
15
~
Resource
();
16
18
void
load
(
LoadResourcesContext
* context = 0);
22
void
unload
();
23
25
pugi::xml_attribute
getAttribute
(
const
char
* attr)
const
;
26
pugi::xml_node getNode()
const
{
return
_node;}
27
bool
getUseLoadCounter()
const
{
return
_useLoadCounter;}
28
Resource
* getParent()
const
{
return
_parent;}
29
30
31
void
setUseLoadCounter(
bool
v) {_useLoadCounter = v;}
32
void
setParent(
Resource
* p) {_parent = p;}
33
35
static
std::string
extractID
(
const
pugi::xml_node& node,
const
std::string& file,
const
std::string& def);
36
static
std::string
extractID
(
const
std::string& file);
37
38
protected
:
39
static
void
setNode(
Resource
* res,
const
pugi::xml_node& node) {res->_node = node;}
40
41
virtual
void
_load(
LoadResourcesContext
* context = 0) = 0;
42
virtual
void
_unload() = 0;
43
44
Resource
* _parent;
45
46
int
_loadCounter;
47
bool
_useLoadCounter;
48
49
pugi::xml_node _node;
50
51
private
:
52
//non copyable
53
Resource
(
const
Resource
&);
54
const
Resource
& operator=(
const
Resource
&);
55
};
56
}
57
58
59
EDITOR_INCLUDE(Resource);
oxygine::LoadResourcesContext
Definition:
CreateResourceContext.h:94
oxygine::Resource::getAttribute
pugi::xml_attribute getAttribute(const char *attr) const
oxygine::Resource::unload
void unload()
oxygine::Resource::load
void load(LoadResourcesContext *context=0)
oxygine
–oxgl-end–!
Definition:
Actor.h:14
oxygine::Object
Definition:
Object.h:83
oxygine::Resource
Definition:
Resource.h:10
oxygine::Resource::extractID
static std::string extractID(const pugi::xml_node &node, const std::string &file, const std::string &def)
Generated on Tue Feb 13 2018 05:01:17 for Oxygine by
1.8.14