Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::CMediaManager Class Reference

Media manager. More...

`#include <KeosMediaManager.h>`

Inheritance diagram for Keos::CMediaManager:

List of all members.

## Public Member Functions

void | AddSearchPath (const String &strPath)
| Add a search path directory for the media.
template<class T>
void | RegisterLoader (ILoader< T > *pLoader, const String &strExtensions)
| Register a new T loader.
template<class T>
T * | LoadMediaFromFile (const CFile &Filename) const
| Load a T object from a file.
template<class T>
void | SaveMediaToFile (const T *pObject, const CFile &Filename) const
| Save a T object in a file.
CFile | FindMedia (const CFile &Filename) const
| Find a file in the search path directories.

## Private Member Functions

| CMediaManager ()
| Default constructor.
| ~CMediaManager ()
| Destructor.
template<class T>
ILoader< T > & | FindLoader (const CFile &Filename) const
| Look for the loader corresponding to a given extension.

## Private Attributes

friend | CSingleton<CMediaManager>
std::set< String > | m_Paths
| List of the search paths.

## Detailed Description

Media manager.

Inherit from a CMediaHolder for every managed media

Definition at line 50 of file KeosMediaManager.h.

## Constructor & Destructor Documentation

Keos::CMediaManager::CMediaManager | ( |  | ) | `[private]`

| Default constructor. Definition at line 32 of file KeosMediaManager.cpp. References m_Paths.

Keos::CMediaManager::~CMediaManager | ( |  | ) | `[private]`

| Destructor. Definition at line 39 of file KeosMediaManager.cpp.

## Member Function Documentation

void Keos::CMediaManager::AddSearchPath | ( | const String & | strPath | ) |

| Add a search path directory for the media. Definition at line 45 of file KeosMediaManager.cpp. References m_Paths.

template<class T>
ILoader< T > & Keos::CMediaManager::FindLoader | ( | const CFile & | Filename | ) | const`[inline, private]`

| Look for the loader corresponding to a given extension.

Parameters:

  | Filename | File.

Returns:
  Reference on the loader.

Definition at line 141 of file KeosMediaManager.h.

References LOADINGFAILED_EXCEPT.

CFile Keos::CMediaManager::FindMedia | ( | const CFile & | Filename | ) | const

| Find a file in the search path directories. Definition at line 54 of file KeosMediaManager.cpp. References Keos::CFile::Exists(), LOADINGFAILED_EXCEPT, and m_Paths. Referenced by LoadMediaFromFile().

template<class T>
T * Keos::CMediaManager::LoadMediaFromFile | ( | const CFile & | Filename | ) | const`[inline]`

| Load a T object from a file.

Parameters:

  | Filename | Path of the file.

Returns:
  Pointer on T loaded.

Definition at line 122 of file KeosMediaManager.h.

References FindMedia(), and Keos::CFile::Fullname().

template<class T>
void Keos::CMediaManager::RegisterLoader | ( | ILoader< T > * | pLoader,
|  | const String & | strExtensions
| ) | `[inline]`

| Register a new T loader.

Parameters:

  | pLoader | Pointer on the loader.
  | strExtensions | Extensions associated to the loader.

Definition at line 108 of file KeosMediaManager.h.

Referenced by Keos::CRoot::CRoot().

template<class T>
void Keos::CMediaManager::SaveMediaToFile | ( | const T * | pObject,
|  | const CFile & | Filename
| ) | const`[inline]`

| Save a T object in a file.

Parameters:

  | pObject | Pointer on the object to be saved.
  | Filename | Path of the file.

Definition at line 133 of file KeosMediaManager.h.

## Member Data Documentation

friend Keos::CMediaManager::CSingleton<CMediaManager>`[private]`

| Definition at line 52 of file KeosMediaManager.h.

std::set<String> Keos::CMediaManager::m_Paths`[private]`

| List of the search paths. Definition at line 99 of file KeosMediaManager.h. Referenced by AddSearchPath(), CMediaManager(), and FindMedia().

The documentation for this class was generated from the following files:

- KeosEngine/KeosMediaManager.h
- KeosEngine/KeosMediaManager.cpp