KrisLibrary  1.0.0
Public Member Functions | Public Attributes | List of all members
ResourceBase Class Reference

A generic "resource" that can be saved/loaded to disk. More...

#include <ResourceLibrary.h>

Inheritance diagram for ResourceBase:
BasicResource< T > CompoundResourceBase BasicArrayResource< T > ResourceLibraryResource

Public Member Functions

 ResourceBase (const std::string &name)
 
 ResourceBase (const std::string &name, const std::string &fn)
 
virtual bool Load (const std::string &fn)
 
virtual bool Load ()
 
virtual bool Save (const std::string &fn)
 
virtual bool Save ()
 
virtual bool Load (std::istream &in)
 
virtual bool Save (std::ostream &out)
 
virtual bool Load (TiXmlElement *in)
 
virtual bool Save (TiXmlElement *out)
 
virtual bool Load (AnyCollection &c)
 
virtual bool Save (AnyCollection &c)
 
virtual const char * Type () const
 
virtual ResourceBaseMake ()
 
virtual ResourceBaseCopy ()
 

Public Attributes

std::string name
 
std::string fileName
 

Detailed Description

A generic "resource" that can be saved/loaded to disk.

The subclass must support saving through one or more of the following methods

If the resource library is saved to a directory, then each entry is stored to a separate file.

If the resource library is saved to an xml file, then each entry that supports saving to xml is saved directly in the xml file. If it supports iostreams, then it is outputted directly as a text node in the xml file. If it only supports saving to file, then the filename is stored in the xml file and the resource is dumped to disk.

Member Function Documentation

virtual ResourceBase* ResourceBase::Copy ( )
inlinevirtual

Make a ResourceBase that copies all the contents of this. (Copying the name and fileName are optional)

Reimplemented in ResourceLibraryResource, BasicArrayResource< T >, and BasicResource< T >.

Referenced by ResourceLibraryResource::Make().

virtual ResourceBase* ResourceBase::Make ( )
inlinevirtual

Make a ResourceBase of the same dynamic type as this. ResourceBase instances are their own factories.

Reimplemented in ResourceLibraryResource, BasicArrayResource< T >, and BasicResource< T >.

Referenced by ResourceLibrary::LazyLoadXml().

virtual const char* ResourceBase::Type ( ) const
inlinevirtual

A unique type string used for type indexing and xml output, only alphanumeric characters allowed.

Reimplemented in ResourceLibraryResource, BasicArrayResource< T >, and BasicResource< T >.

Referenced by CompoundResourceBase::Pack().


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