KrisLibrary
1.0.0
|
A resource that is composed of multiple sub-objects, which can themselves be considered resources. More...
#include <ResourceLibrary.h>
Public Member Functions | |
CompoundResourceBase (const std::string &name) | |
CompoundResourceBase (const std::string &name, const std::string &fileName) | |
virtual std::vector< std::string > | CastTypes () const |
Returns a list of subtypes that can be used in Cast. | |
virtual std::vector< std::string > | ExtractTypes () const |
Returns a list of subtypes that can be used in Extract. | |
virtual std::vector< std::string > | SubTypes () const |
Returns a list of subtypes that will be produced in Unpack. | |
virtual ResourcePtr | Cast (const char *type) |
virtual bool | Extract (const char *subtype, std::vector< ResourcePtr > &subobjects) |
virtual bool | Pack (std::vector< ResourcePtr > &subobjects, std::string *errorMessage=NULL) |
virtual bool | Unpack (std::vector< ResourcePtr > &subobjects, bool *incomplete=NULL) |
Public Member Functions inherited from ResourceBase | |
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 ResourceBase * | Make () |
virtual ResourceBase * | Copy () |
Additional Inherited Members | |
Public Attributes inherited from ResourceBase | |
std::string | name |
std::string | fileName |
A resource that is composed of multiple sub-objects, which can themselves be considered resources.
Subclasses should overload casting, extracting, packing, and unpacking methods to implement compound functionality.
|
inlinevirtual |
Returns a copy of the resource cast to a resource of another type
|
virtual |
Extracts all items of the given subtype. Default uses Unpack to find objects of the right type.
Reimplemented in ResourceLibraryResource, and BasicArrayResource< T >.
|
inlinevirtual |
Creates the object of out of the given resources, returning true if successful. If unsuccessful, the error message may be set to an informative description of the error.
Reimplemented in ResourceLibraryResource, and BasicArrayResource< T >.
References ResourceBase::Type().
|
inlinevirtual |
Creates a list of sub-objects that describe the given resource. If the decomposition succeeded, returns true If the decomposition succeeded but is incomplete, the flag incomplete is set to true (if non-null). Here "incomplete" means that calling Pack on the return array may NOT produce an exact copy of r.
Reimplemented in ResourceLibraryResource, and BasicArrayResource< T >.