![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <FileList.h>
Public Member Functions | |
| void | AddCallback (FileListProgress *cb) |
| Adds a callback to get progress reports about what the file list instances do. | |
| void | AddFile (const char *filename, const char *fullPathToFile, const char *data, const unsigned dataLength, const unsigned fileLength, FileListNodeContext context, bool isAReference=false, bool takeDataPointer=false) |
| Add a file, given data already in memory. | |
| void | AddFile (const char *filepath, const char *filename, FileListNodeContext context) |
| Add a file, reading it from disk. | |
| void | AddFilesFromDirectory (const char *applicationDirectory, const char *subDirectory, bool writeHash, bool writeData, bool recursive, FileListNodeContext context) |
| Add all the files at a given directory. | |
| void | Clear (void) |
| Deallocate all memory. | |
| void | ClearCallbacks (void) |
| Removes all callbacks. | |
| void | DeleteFiles (const char *applicationDirectory) |
| Delete all files stored in the file list. | |
| bool | Deserialize (RakNet::BitStream *inBitStream) |
| Read all encoded data from a bitstream. Clear() is called before deserializing. | |
| FileList () | |
| void | FlagFilesAsReferences (void) |
| void | GetCallbacks (DataStructures::List< FileListProgress * > &callbacks) |
| void | GetDeltaToCurrent (FileList *input, FileList *output, const char *dirSubset, const char *remoteSubdir) |
| Return the files that need to be written to make input match this current FileList. | |
| void | ListMissingOrChangedFiles (const char *applicationDirectory, FileList *missingOrChangedFiles, bool alwaysWriteHash, bool neverWriteHash) |
| Given the existing set of files, search applicationDirectory for the same files. | |
| void | PopulateDataFromDisk (const char *applicationDirectory, bool writeFileData, bool writeFileHash, bool removeUnknownFiles) |
| Assuming FileList contains a list of filenames presumably without data, read the data for these filenames. | |
| void | RemoveCallback (FileListProgress *cb) |
| Removes a callback. | |
| void | Serialize (RakNet::BitStream *outBitStream) |
| Write all encoded data into a bitstream. | |
| void | WriteDataToDisk (const char *applicationDirectory) |
| Write all files to disk, prefixing the paths with applicationDirectory. | |
| ~FileList () | |
Static Public Member Functions | |
| static void | DestroyInstance (FileList *i) |
| static bool | FixEndingSlash (char *str) |
| static FileList * | GetInstance (void) |
Public Attributes | |
| DataStructures::List < FileListNode > | fileList |
Protected Attributes | |
| DataStructures::List < FileListProgress * > | fileListProgressCallbacks |
Definition at line 145 of file FileList.h.
| RakNet::FileList::FileList | ( | ) |
| RakNet::FileList::~FileList | ( | ) |
| void RakNet::FileList::AddCallback | ( | FileListProgress * | cb | ) |
| [in] | cb | A pointer to an externally defined instance of FileListProgress. This pointer is held internally, so should remain valid as long as this class is valid. |
| void RakNet::FileList::AddFile | ( | const char * | filename, |
| const char * | fullPathToFile, | ||
| const char * | data, | ||
| const unsigned | dataLength, | ||
| const unsigned | fileLength, | ||
| FileListNodeContext | context, | ||
| bool | isAReference = false, |
||
| bool | takeDataPointer = false |
||
| ) |
| [in] | filename | Name of a file, optionally prefixed with a partial or complete path. Use \ as the path delineator. |
| [in] | fullPathToFile | Full path to the file on disk |
| [in] | data | Contents to write |
| [in] | dataLength | length of the data, which may be greater than fileLength should you prefix extra data, such as the hash |
| [in] | fileLength | Length of the file |
| [in] | context | User defined byte to store with each file. Use for whatever you want. |
| [in] | isAReference | Means that this is just a reference to a file elsewhere - does not actually have any data |
| [in] | takeDataPointer | If true, do not allocate dataLength. Just take the pointer passed to the data parameter |
| void RakNet::FileList::AddFile | ( | const char * | filepath, |
| const char * | filename, | ||
| FileListNodeContext | context | ||
| ) |
| [in] | filepath | Complete path to the file, including the filename itself |
| [in] | filename | filename to store internally, anything you want, but usually either the complete path or a subset of the complete path. |
| [in] | context | User defined byte to store with each file. Use for whatever you want. |
| void RakNet::FileList::AddFilesFromDirectory | ( | const char * | applicationDirectory, |
| const char * | subDirectory, | ||
| bool | writeHash, | ||
| bool | writeData, | ||
| bool | recursive, | ||
| FileListNodeContext | context | ||
| ) |
| [in] | applicationDirectory | The first part of the path. This is not stored as part of the filename. Use \ as the path delineator. |
| [in] | subDirectory | The rest of the path to the file. This is stored as a prefix to the filename |
| [in] | writeHash | The first 4 bytes is a hash of the file, with the remainder the actual file data (should writeData be true) |
| [in] | writeData | Write the contents of each file |
| [in] | recursive | Whether or not to visit subdirectories |
| [in] | context | User defined byte to store with each file. Use for whatever you want. |
| void RakNet::FileList::Clear | ( | void | ) |
| void RakNet::FileList::ClearCallbacks | ( | void | ) |
| void RakNet::FileList::DeleteFiles | ( | const char * | applicationDirectory | ) |
| [in] | applicationDirectory | Prefixed to the path to each filename. Use \ as the path delineator. |
| bool RakNet::FileList::Deserialize | ( | RakNet::BitStream * | inBitStream | ) |
| static void RakNet::FileList::DestroyInstance | ( | FileList * | i | ) | [static] |
| static bool RakNet::FileList::FixEndingSlash | ( | char * | str | ) | [static] |
| void RakNet::FileList::FlagFilesAsReferences | ( | void | ) |
By default, GetDeltaToCurrent tags files as non-references, meaning they are assumed to be populated later This tags all files as references, required for IncrementalReadInterface to process them incrementally
| void RakNet::FileList::GetCallbacks | ( | DataStructures::List< FileListProgress * > & | callbacks | ) |
Returns all callbacks added with AddCallback()
| [out] | callbacks | The list is set to the list of callbacks |
| void RakNet::FileList::GetDeltaToCurrent | ( | FileList * | input, |
| FileList * | output, | ||
| const char * | dirSubset, | ||
| const char * | remoteSubdir | ||
| ) |
Specify dirSubset to only consider files that start with this path specify remoteSubdir to assume that all filenames in input start with this path, so strip it off when comparing filenames.
| [in] | input | Full list of files |
| [out] | output | Files that we need to match input |
| [in] | dirSubset | If the filename does not start with this path, just skip this file. |
| [in] | remoteSubdir | Remove this from the filenames of input when comparing to existing filenames. |
| static FileList* RakNet::FileList::GetInstance | ( | void | ) | [static] |
| void RakNet::FileList::ListMissingOrChangedFiles | ( | const char * | applicationDirectory, |
| FileList * | missingOrChangedFiles, | ||
| bool | alwaysWriteHash, | ||
| bool | neverWriteHash | ||
| ) |
For each file that is missing or different, add that file to missingOrChangedFiles. Note: the file contents are not written, and only the hash if written if alwaysWriteHash is true alwaysWriteHash and neverWriteHash are optimizations to avoid reading the file contents to generate the hash if not necessary because the file is missing or has different lengths anyway.
| [in] | applicationDirectory | The first part of the path. This is not stored as part of the filename. Use \ as the path delineator. |
| [out] | missingOrChangedFiles | Output list written to |
| [in] | alwaysWriteHash | If true, and neverWriteHash is false, will hash the file content of the file on disk, and write that as the file data with a length of SHA1_LENGTH bytes. If false, if the file length is different, will only write the filename. |
| [in] | neverWriteHash | If true, will never write the hash, even if available. If false, will write the hash if the file lengths are the same and it was forced to do a comparison. |
| void RakNet::FileList::PopulateDataFromDisk | ( | const char * | applicationDirectory, |
| bool | writeFileData, | ||
| bool | writeFileHash, | ||
| bool | removeUnknownFiles | ||
| ) |
| [in] | applicationDirectory | Prepend this path to each filename. Trailing slash will be added if necessary. Use \ as the path delineator. |
| [in] | writeFileData | True to read and store the file data. The first SHA1_LENGTH bytes will contain the hash if writeFileHash is true |
| [in] | writeFileHash | True to read and store the hash of the file data. The first SHA1_LENGTH bytes will contain the hash if writeFileHash is true |
| [in] | removeUnknownFiles | If a file does not exist on disk but is in the file list, remove it from the file list? |
| void RakNet::FileList::RemoveCallback | ( | FileListProgress * | cb | ) |
| [in] | cb | A pointer to an externally defined instance of FileListProgress that was previously added with AddCallback() |
| void RakNet::FileList::Serialize | ( | RakNet::BitStream * | outBitStream | ) |
| void RakNet::FileList::WriteDataToDisk | ( | const char * | applicationDirectory | ) |
| [in] | applicationDirectory | path prefix |
Definition at line 241 of file FileList.h.
Definition at line 245 of file FileList.h.
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.