Crossfire Server, Trunk
WrapperLoader Class Reference

#include <WrapperLoader.h>

+ Inheritance diagram for WrapperLoader:
+ Collaboration diagram for WrapperLoader:

Public Types

typedef std::function< void(BufferReader *, const char *)> wrapped
 

Public Member Functions

virtual void load (BufferReader *reader, const std::string &filename) override
 
virtual bool willLoad (const std::string &filename) override
 
 WrapperLoader (const std::string &name, wrapped fct)
 
- Public Member Functions inherited from AssetLoader
virtual ~AssetLoader ()
 

Private Attributes

wrapped m_function
 
std::string m_name
 

Detailed Description

Loader calling a function for files ending with a specific string.

Definition at line 25 of file WrapperLoader.h.

Member Typedef Documentation

◆ wrapped

typedef std::function<void(BufferReader *, const char *)> WrapperLoader::wrapped

Wrapper to the function to call for each file.

Definition at line 28 of file WrapperLoader.h.

Constructor & Destructor Documentation

◆ WrapperLoader()

WrapperLoader::WrapperLoader ( const std::string &  name,
wrapped  fct 
)
inline

Standard construction.

Parameters
namesuffix to match to load the file.
fctfunction to call to load the file.

Definition at line 35 of file WrapperLoader.h.

Member Function Documentation

◆ load()

virtual void WrapperLoader::load ( BufferReader reader,
const std::string &  filename 
)
inlineoverridevirtual

Load assets from the specified reader.

Parameters
readerreader.
filenamefull filename.

Implements AssetLoader.

Definition at line 42 of file WrapperLoader.h.

References npc_dialog::filename, and m_function.

◆ willLoad()

virtual bool WrapperLoader::willLoad ( const std::string &  filename)
inlineoverridevirtual

Whether this instance will process or not the specified file.

Parameters
filenamefull file path.
Returns
true if processFile() should be called, false else.

Implements AssetLoader.

Definition at line 38 of file WrapperLoader.h.

References Utils::endsWith(), npc_dialog::filename, and m_name.

+ Here is the call graph for this function:

Field Documentation

◆ m_function

wrapped WrapperLoader::m_function
private

Function to call.

Definition at line 48 of file WrapperLoader.h.

Referenced by load().

◆ m_name

std::string WrapperLoader::m_name
private

File name.

Definition at line 47 of file WrapperLoader.h.

Referenced by willLoad().


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