ScummVM API documentation
Sword25::PackageManager Class Reference

#include <packagemanager.h>

Inheritance diagram for Sword25::PackageManager:
Sword25::Service

Public Types

enum  FILE_TYPES { FT_DIRECTORY = (1 << 0), FT_FILE = (1 << 1) }
 

Public Member Functions

 PackageManager (Kernel *pKernel)
 
void setRunWithExtractedFiles (const Common::Path &directoryName)
 
bool loadPackage (const Common::Path &fileName, const Common::String &mountPosition)
 
bool loadDirectoryAsPackage (const Common::Path &directoryName, const Common::String &mountPosition)
 
byte * getFile (const Common::String &fileName, uint *pFileSize=NULL)
 
Common::SeekableReadStreamgetStream (const Common::String &fileName)
 
char * getXmlFile (const Common::String &fileName, uint *pFileSize=NULL)
 
Common::String getCurrentDirectory ()
 
bool changeDirectory (const Common::String &directory)
 
Common::String getAbsolutePath (const Common::String &fileName)
 
int doSearch (Common::ArchiveMemberList &list, const Common::String &filter, const Common::String &path, uint typeFilter=FT_DIRECTORY|FT_FILE)
 
bool fileExists (const Common::String &FileName)
 

Additional Inherited Members

- Protected Member Functions inherited from Sword25::Service
 Service (Kernel *pKernel)
 
KernelGetKernel () const
 

Detailed Description

The Package Manager interface

  1. It creates a completely new (virtual) directory tree in the packages and directories can be mounted.
  2. To separate elements of a directory path '/' must be used rather than '\'
  3. LoadDirectoryAsPackage should only be used for testing. The final release will be have all files in packages.

Member Function Documentation

◆ setRunWithExtractedFiles()

void Sword25::PackageManager::setRunWithExtractedFiles ( const Common::Path directoryName)
inline

Set the PackageManager to run on extracted game files.s

◆ loadPackage()

bool Sword25::PackageManager::loadPackage ( const Common::Path fileName,
const Common::String mountPosition 
)

Mounts the contents of a package in the directory specified in the directory tree.

Parameters
FileNameThe filename of the package to mount
MountPositionThe directory name under which the package should be mounted
Returns
Returns true if the mount was successful, otherwise false.

◆ loadDirectoryAsPackage()

bool Sword25::PackageManager::loadDirectoryAsPackage ( const Common::Path directoryName,
const Common::String mountPosition 
)

Mounts the contents of a directory in the specified directory in the directory tree.

Parameters
Thename of the directory to mount
MountPositionThe directory name under which the package should be mounted
Returns
Returns true if the mount was successful, otherwise false.

◆ getFile()

byte* Sword25::PackageManager::getFile ( const Common::String fileName,
uint *  pFileSize = NULL 
)

Downloads a file from the directory tree

Parameters
FileNameThe filename of the file to load
pFileSizePointer to the variable that will contain the size of the loaded file. The deafult is NULL.
Returns
Specifies a pointer to the loaded data of the file
Remarks
The client must not forget to release the data of the file using BE_DELETE_A.

◆ getStream()

Common::SeekableReadStream* Sword25::PackageManager::getStream ( const Common::String fileName)

Returns a stream from file file from the directory tree

Parameters
FileNameThe filename of the file to load
Returns
Pointer to the stream object

◆ getXmlFile()

char* Sword25::PackageManager::getXmlFile ( const Common::String fileName,
uint *  pFileSize = NULL 
)
inline

Downloads an XML file and prefixes it with an XML Version key, since the XML files don't contain it, and it is required for ScummVM to correctly parse the XML.

Parameters
FileNameThe filename of the file to load
pFileSizePointer to the variable that will contain the size of the loaded file. The deafult is NULL.
Returns
Specifies a pointer to the loaded data of the file
Remarks
The client must not forget to release the data of the file using BE_DELETE_A.

◆ getCurrentDirectory()

Common::String Sword25::PackageManager::getCurrentDirectory ( )
inline

Returns the path to the current directory.

Returns
Returns a string containing the path to the current directory. If the path could not be determined, an empty string is returned.
Remarks
For cutting path elements '\' is used rather than '/' elements.

◆ changeDirectory()

bool Sword25::PackageManager::changeDirectory ( const Common::String directory)

Changes the current directory.

Parameters
DirectoryThe path to the new directory. The path can be relative.
Returns
Returns true if the operation was successful, otherwise false.
Remarks
For cutting path elements '\' is used rather than '/' elements.

◆ getAbsolutePath()

Common::String Sword25::PackageManager::getAbsolutePath ( const Common::String fileName)

Returns the absolute path to a file in the directory tree.

Parameters
FileNameThe filename of the file whose absolute path is to be determined. These parameters may include both relative and absolute paths.
Returns
Returns an absolute path to the given file.
Remarks
For cutting path elements '\' is used rather than '/' elements.

◆ doSearch()

int Sword25::PackageManager::doSearch ( Common::ArchiveMemberList list,
const Common::String filter,
const Common::String path,
uint  typeFilter = FT_DIRECTORY|FT_FILE 
)

Creates a BS_PackageManager::FileSearch object to search for files

Parameters
FilterSpecifies the search string. Wildcards of '*' and '?' are allowed
PathSpecifies the directory that should be searched.
TypeFilterA combination of flags BS_PackageManager::FT_DIRECTORY and BS_PackageManager::FT_FILE. These flags indicate whether to search for files, directories, or both. The default is BS_PackageManager::FT_DIRECTORY | BS_PackageManager::FT_FILE
Returns
Specifies a pointer to a BS_PackageManager::FileSearch object, or NULL if no file was found.
Remarks
Do not forget to delete the object after use.

◆ fileExists()

bool Sword25::PackageManager::fileExists ( const Common::String FileName)

Determines whether a file exists

Parameters
FileNameThe filename
Returns
Returns true if the file exists, otherwise false.

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