nomlib
Loading...
Searching...
No Matches
nom::ResourceFile Class Reference

Descriptor of a file-based resource. More...

#include <ResourceFile.hpp>

Public Types

enum  Type {
  Invalid = 0 , Graphic , Movie , Audio ,
  TrueTypeFont , BitmapFont
}
typedef ResourceFile self_type

Public Member Functions

 ResourceFile (void)
 Default constructor; initialize resource to an invalid state.
virtual ~ResourceFile (void)
 Destructor.
 ResourceFile (const std::string &name)
 Construct an invalid resource.
 ResourceFile (const std::string &name, const std::string &file_path)
 Construct a minimal, but valid resource.
 ResourceFile (const std::string &name, const std::string &file_path, ResourceFile::Type type)
 Construct a complete resource.
bool operator< (const self_type &rhs) const
 Lesser-than comparison method overload.
bool operator== (const self_type &rhs) const
 Equality comparison method overload.
bool exists (void) const
 Get the status of resource existence at the file-system level.
const std::string & name (void) const
 Get the name of the resource.
const std::string & path (void) const
 Get the absolute file path to the resource.
ResourceFile::Type type (void) const
 Get the resource's type.
bool loaded (void) const
void set_name (const std::string &name)
 Set the resource's name.
void set_path (const std::string &file_path)
 Set the resource's absolute file path.
void set_type (ResourceFile::Type type)
 Set the resource's type.
void set_loaded (bool state)

Public Attributes

bool loaded_
 Initialized resource object state.

Static Public Attributes

static const ResourceFile null

Private Attributes

std::string name_
 The resource's referenced name (think: key).
std::string path_
 The absolute file path to the resource.
ResourceFile::Type type_
 The description of the resource.

Detailed Description

Descriptor of a file-based resource.

See also
nom::ResourceCache.

Definition at line 43 of file ResourceFile.hpp.

Member Typedef Documentation

◆ self_type

typedef ResourceFile nom::ResourceFile::self_type

Definition at line 46 of file ResourceFile.hpp.

Member Enumeration Documentation

◆ Type

enum nom::ResourceFile::Type

Definition at line 50 of file ResourceFile.hpp.

Constructor & Destructor Documentation

◆ ResourceFile()

nom::ResourceFile::ResourceFile ( const std::string & name)

Construct an invalid resource.

Remarks
This constructor is intended for use with internal queries made to the resource cache.

Member Function Documentation

◆ operator<()

bool nom::ResourceFile::operator< ( const self_type & rhs) const

Lesser-than comparison method overload.

Remarks
The resource name is used in the comparison.
Note
This operator method overload is a required implementation for use within a std::map.

◆ operator==()

bool nom::ResourceFile::operator== ( const self_type & rhs) const

Equality comparison method overload.

Note
This operator method overload is a required implementation for use within a std::map.

◆ type()

ResourceFile::Type nom::ResourceFile::type ( void ) const

Get the resource's type.

See also
nom::RESOURCE_TYPE enumeration.

Member Data Documentation

◆ loaded_

bool nom::ResourceFile::loaded_
mutable

Initialized resource object state.

Todo
No idea why I have to declare this mutable and access it directly, but ::ResourceCache::load_resource refuses to compile otherwise, complaining about const issues with ::set_loaded.

Definition at line 135 of file ResourceFile.hpp.

◆ name_

std::string nom::ResourceFile::name_
private

The resource's referenced name (think: key).

Definition at line 121 of file ResourceFile.hpp.

◆ null

const ResourceFile nom::ResourceFile::null
static

Definition at line 48 of file ResourceFile.hpp.

◆ path_

std::string nom::ResourceFile::path_
private

The absolute file path to the resource.

Definition at line 124 of file ResourceFile.hpp.

◆ type_

ResourceFile::Type nom::ResourceFile::type_
private

The description of the resource.

Definition at line 127 of file ResourceFile.hpp.


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