dtDAL::ResourceTypeHandler Class Reference

pure virtual class that handles a kind of resource. More...

#include <resourcehelper.h>

Inheritance diagram for dtDAL::ResourceTypeHandler:

dtDAL::DirectoryResourceTypeHandler dtDAL::RBodyResourceTypeHandler

List of all members.

Public Member Functions

 ResourceTypeHandler ()
virtual bool HandlesFile (const std::string &path, dtUtil::FileType type) const =0
 
Note:
the file type is provided so that implementations that only need to check extensions will not have to stat the file to see if it's a regular file or directory.

virtual ResourceDescriptor CreateResourceDescriptor (const std::string &category, const std::string &fileName) const =0
 Creates a resource descriptor based on the path to the resource.
virtual const std::string ImportResourceToPath (const std::string &newName, const std::string &srcPath, const std::string &destCategoryPath) const =0
 Import a resource into a project given the file, and the path.
virtual void RemoveResource (const std::string &resourcePath) const =0
 removes a resource.
virtual bool ImportsDirectory () const =0
 
Returns:
true if the resource imports directories.

virtual bool ResourceIsDirectory () const =0
 
Returns:
true if the imported resource is a directory.

virtual const std::string & GetResourceDirectoryExtension () const =0
 
Returns:
the extension string or undefined if ResourceIsDirectory if false

virtual const std::map
< std::string, std::string > & 
GetFileFilters () const =0
 
Note:
the extensions should not have the "*" in front of them so that they can be used internally.

virtual const std::string & GetTypeHandlerDescription () const =0
 
Returns:
A description for this suitable for answering the question "What does this import?"

virtual const DataTypeGetResourceType () const =0
 
Returns:
the resource data type this helper is used with.


Protected Member Functions

virtual ~ResourceTypeHandler ()


Detailed Description

pure virtual class that handles a kind of resource.

Constructor & Destructor Documentation

dtDAL::ResourceTypeHandler::ResourceTypeHandler (  )  [inline]

virtual dtDAL::ResourceTypeHandler::~ResourceTypeHandler (  )  [inline, protected, virtual]


Member Function Documentation

virtual bool dtDAL::ResourceTypeHandler::HandlesFile ( const std::string &  path,
dtUtil::FileType  type 
) const [pure virtual]

Note:
the file type is provided so that implementations that only need to check extensions will not have to stat the file to see if it's a regular file or directory.

Parameters:
path The full path to the file or directory to check.
type The filetype, whether a directory or file.
Returns:
true if the file name is a file that would be handled by this handler.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual ResourceDescriptor dtDAL::ResourceTypeHandler::CreateResourceDescriptor ( const std::string &  category,
const std::string &  fileName 
) const [pure virtual]

Creates a resource descriptor based on the path to the resource.

Parameters:
category the category of the resource.
fileName the name of the file.
Returns:
The resource descriptor base on the path to the resource.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual const std::string dtDAL::ResourceTypeHandler::ImportResourceToPath ( const std::string &  newName,
const std::string &  srcPath,
const std::string &  destCategoryPath 
) const [pure virtual]

Import a resource into a project given the file, and the path.

The path can be retrieved by calling ResourceHelper.createResourceCategory

See also:
ResourceHelper::createResourceCategory
Parameters:
newName the name to give the resource. This should not include the extension.
srcPath the path to the file or directory to import
destCategoryPath the full path to the destination. This must exist already.
Exceptions:
ExceptionEnum::ProjectFileNotFound if source of destination files do not exist.
ExceptionEnum::ProjectIOException if an error occurs copying the data.
Returns:
the display fileName associated with this resource

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual void dtDAL::ResourceTypeHandler::RemoveResource ( const std::string &  resourcePath  )  const [pure virtual]

removes a resource.

The current directory will be the root of the project when this is called.

Parameters:
resourcePath path to the file the file getResourcePath returns

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual bool dtDAL::ResourceTypeHandler::ImportsDirectory (  )  const [pure virtual]

Returns:
true if the resource imports directories.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual bool dtDAL::ResourceTypeHandler::ResourceIsDirectory (  )  const [pure virtual]

Returns:
true if the imported resource is a directory.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual const std::string& dtDAL::ResourceTypeHandler::GetResourceDirectoryExtension (  )  const [pure virtual]

Returns:
the extension string or undefined if ResourceIsDirectory if false

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual const std::map<std::string, std::string>& dtDAL::ResourceTypeHandler::GetFileFilters (  )  const [pure virtual]

Note:
the extensions should not have the "*" in front of them so that they can be used internally.

Returns:
a map of file extensions and their associated descriptions that will match this helper.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual const std::string& dtDAL::ResourceTypeHandler::GetTypeHandlerDescription (  )  const [pure virtual]

Returns:
A description for this suitable for answering the question "What does this import?"

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.

virtual const DataType& dtDAL::ResourceTypeHandler::GetResourceType (  )  const [pure virtual]

Returns:
the resource data type this helper is used with.

Implemented in dtDAL::DirectoryResourceTypeHandler, and dtDAL::RBodyResourceTypeHandler.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008