1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
/*
$Id: resource_manager.cpp,v 1.9 2001/12/15 01:30:07 mbn Exp $
------------------------------------------------------------------------
ClanLib, the platform independent game SDK.
This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
version 2. See COPYING for details.
For a total list of contributers see CREDITS.
------------------------------------------------------------------------
*/
#include "Core/precomp.h"
#include <iostream>
#include "API/Core/Resources/resource_manager.h"
#include "resource_manager_file.h"
/////////////////////////////////////////////////////////////////////////////
// CL_ResourceManager construction:
CL_ResourceManager::CL_ResourceManager(
const std::string &config_file,
CL_InputSourceProvider *provider,
bool read_directly_from_source,
bool delete_inputsource_provider)
: impl(NULL)
{
impl = new CL_ResourceManager_File(
config_file,
provider,
read_directly_from_source,
delete_inputsource_provider);
}
CL_ResourceManager::CL_ResourceManager(
const std::string &config_file,
const bool is_datafile)
: impl(NULL)
{
impl = new CL_ResourceManager_File(
config_file,
is_datafile);
}
CL_ResourceManager::CL_ResourceManager(
const std::string &config_file,
const bool is_datafile,
CL_ResourceManager &additional_resources)
: impl(NULL)
{
impl = new CL_ResourceManager_File(
config_file,
is_datafile);
add_resources(additional_resources);
}
CL_ResourceManager::CL_ResourceManager(const CL_ResourceManager ©)
: impl(NULL)
{
impl = copy.impl;
impl->add_ref();
}
CL_ResourceManager::CL_ResourceManager()
: impl(NULL)
{
impl = new CL_ResourceManager_File;
}
CL_ResourceManager::CL_ResourceManager(class CL_ResourceManager_File *impl)
: impl(impl)
{
if (impl != NULL) impl->add_ref();
}
CL_ResourceManager::~CL_ResourceManager()
{
if (impl) impl->release_ref();
}
/////////////////////////////////////////////////////////////////////////////
// CL_ResourceManager attributes:
CL_Resource &CL_ResourceManager::get_resource(const std::string &res_id)
{
return impl->get_resource(res_id);
}
std::list<std::string> *CL_ResourceManager::get_all_resources()
{
return impl->get_all_resources();
}
std::list<std::string> *CL_ResourceManager::get_resources_of_type(const std::string &type_id)
{
return impl->get_resources_of_type(type_id);
}
CL_InputSourceProvider *CL_ResourceManager::get_resource_provider() const
{
return impl->get_resource_provider();
}
bool CL_ResourceManager::is_from_source()
{
return impl->from_source;
}
/////////////////////////////////////////////////////////////////////////////
// CL_ResourceManager operations:
void CL_ResourceManager::operator = (const CL_ResourceManager ©)
{
if (impl) impl->release_ref();
impl = copy.impl;
if (impl) impl->add_ref();
}
void CL_ResourceManager::add_resources(const CL_ResourceManager &additional_resources)
{
impl->add_resources(additional_resources.impl);
}
void CL_ResourceManager::remove_resources(const CL_ResourceManager &additional_resources)
{
impl->remove_resources(additional_resources.impl);
}
void CL_ResourceManager::load_all()
{
impl->load_all();
}
void CL_ResourceManager::unload_all()
{
impl->unload_all();
}
void CL_ResourceManager::load_section(const std::string §ion_name)
{
impl->load_section(section_name);
}
void CL_ResourceManager::unload_section(const std::string §ion_name)
{
impl->unload_section(section_name);
}
|