HoverRace  2.0
Public Member Functions | Private Types | Private Attributes | List of all members
HoverRace::Display::MediaRes< T > Class Template Reference

Represents a file in the game's media directory. More...

#include <MediaRes.h>

+ Inheritance diagram for HoverRace::Display::MediaRes< T >:

Public Member Functions

 MediaRes (const Util::OS::path_t &path)
 Constructor. More...
 
virtual ~MediaRes ()
 
std::string GetId () const override
 Retrieve the ID for this resource. More...
 
std::unique_ptr< std::istream > Open () const override
 Open the stream for reading. More...
 
- Public Member Functions inherited from HoverRace::Display::Res< T >
virtual ~Res ()
 
- Public Member Functions inherited from HoverRace::Display::BaseRes
virtual ~BaseRes ()
 

Private Types

using SUPER = Res< T >
 

Private Attributes

std::string id
 
Util::OS::path_t path
 

Detailed Description

template<class T>
class HoverRace::Display::MediaRes< T >

Represents a file in the game's media directory.

Author
Michael Imamura

Member Typedef Documentation

template<class T >
using HoverRace::Display::MediaRes< T >::SUPER = Res<T>
private

Constructor & Destructor Documentation

template<class T >
HoverRace::Display::MediaRes< T >::MediaRes ( const Util::OS::path_t path)
inline

Constructor.

Parameters
pathFile path, relative to the media directory.
template<class T >
virtual HoverRace::Display::MediaRes< T >::~MediaRes ( )
inlinevirtual

Member Function Documentation

template<class T >
std::string HoverRace::Display::MediaRes< T >::GetId ( ) const
inlineoverridevirtual

Retrieve the ID for this resource.

The ID should be unique for every resource being pointed at, so two instances that point to the same resource (e.g. a file) should return the same ID.

This allows loaded resources to be cached, so if two instances point to, say, the same file, then the resource will be loaded once (although this is left as an exercise for the Display).

Returns
The identifier.

Implements HoverRace::Display::BaseRes.

template<class T >
std::unique_ptr<std::istream> HoverRace::Display::MediaRes< T >::Open ( ) const
inlineoverridevirtual

Open the stream for reading.

Returns
The input stream.
Exceptions
ResourceLoadExn

Implements HoverRace::Display::BaseRes.

Member Data Documentation

template<class T >
std::string HoverRace::Display::MediaRes< T >::id
private
template<class T >
Util::OS::path_t HoverRace::Display::MediaRes< T >::path
private

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