Crossfire Server, Trunk
|
#include <AssetCollector.h>
Public Member Functions | |
void | addLoader (AssetLoader *loader) |
AssetCollector () | |
void | collect (const std::string &directory) |
virtual void | load (BufferReader *reader, const std::string &filename) override |
virtual bool | willLoad (const std::string &) override |
virtual | ~AssetCollector () |
Public Member Functions inherited from AssetLoader | |
virtual | ~AssetLoader () |
Protected Member Functions | |
void | processFiles (const std::vector< std::string > &files) |
Protected Attributes | |
std::vector< AssetLoader * > | m_loaders |
BufferReader * | m_reader |
Assets collector, recursing in directories and calling loaders on found files. It inherits AssetLoader to be used with TarLoader.
Definition at line 24 of file AssetCollector.h.
AssetCollector::AssetCollector | ( | ) |
Constructor.
Definition at line 29 of file AssetCollector.cpp.
References bufferreader_create(), and m_reader.
|
virtual |
Destructor.
Definition at line 33 of file AssetCollector.cpp.
References bufferreader_destroy(), m_loaders, and m_reader.
|
inline |
Register a loader to be called on found files. Ownership of the loader is taken by the AssetCollector.
loader | instance to register. |
Definition at line 40 of file AssetCollector.h.
References m_loaders.
Referenced by assets_collect().
void AssetCollector::collect | ( | const std::string & | directory | ) |
Recurse in the specified directory, finding all files and calling loaders to process them.
directory | starting path, with or without a trailing slash. |
Definition at line 54 of file AssetCollector.cpp.
References closedir(), names, opendir(), processFiles(), readdir(), is_valid_types_gen::type, and nlohmann::detail::void().
Referenced by assets_collect().
|
overridevirtual |
Load assets from the specified reader.
reader | reader. |
filename | full filename. |
Implements AssetLoader.
Definition at line 91 of file AssetCollector.cpp.
References npc_dialog::filename, and m_loaders.
|
protected |
Process a list of files.
files | full path of files to process. |
Definition at line 40 of file AssetCollector.cpp.
References bufferreader_init_from_file(), mad_mage_user::file, llevError, m_loaders, and m_reader.
Referenced by collect().
|
inlineoverridevirtual |
Whether this instance will process or not the specified file.
filename | full file path. |
Implements AssetLoader.
Definition at line 48 of file AssetCollector.h.
|
protected |
Registered loaders.
Definition at line 55 of file AssetCollector.h.
Referenced by addLoader(), load(), processFiles(), and ~AssetCollector().
|
protected |
Reader used to load files.
Definition at line 56 of file AssetCollector.h.
Referenced by AssetCollector(), processFiles(), and ~AssetCollector().