Game Development Reference
In-Depth Information
Try to extend the proposed framework with network paths mount points.
class iMountPoint: public iObject
{
public:
2.
Check if the ile exists at this mount point:
virtual bool FileExists( const string& VName ) const = 0;
3. Convert a virtual ilename, which is the name of this ile in our folders tree, to a full
ilename behind this mount point:
virtual string MapName( const string& VName ) const = 0;
4. We will need to create a ile reader that can be used with the FileMapper class,
for the speciied virtual ile inside this mount point:
virtual clPtr<iRawFile> CreateReader(
const string& Name ) const = 0;
};
5.
For physical folders we provide a simple implementation that creates instances
of the FileMapper class with the reference to iRawFile :
class PhysicalMountPoint: public iMountPoint
{
public:
explicit PhysicalMountPoint(const std::string& PhysicalName);
virtual bool FileExists(
const std::string& VirtualName ) const
{ return FS_FileExistsPhys( MapName( VirtualName ) ); }
virtual std::string MapName(
const std::string& VirtualName ) const
{
return ( FS_IsFullPath( VirtualName ) ) ?
VirtualName : ( FPhysicalName + VirtualName );
}
6.
Create the reader to access the data inside this mount point:
virtual clPtr<iRawFile> CreateReader(
const std::string& VirtualName ) const
{
std::string PhysName = FS_IsFullPath( VirtualName ) ?
VirtualName : MapName( VirtualName );
clPtr<RawFile> File = new RawFile();
return !File->Open( FS_ValidatePath( PhysName ),
 
Search WWH ::




Custom Search