Crossfire Server, Trunk
AssetCollector.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2020-2021 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef ASSETCOLLECTOR_H
14 #define ASSETCOLLECTOR_H
15 
16 #include <vector>
17 #include <string>
18 #include "AssetLoader.h"
19 
24 class AssetCollector : public AssetLoader {
25 public:
33  virtual ~AssetCollector();
34 
40  void addLoader(AssetLoader *loader) { m_loaders.push_back(loader); }
41 
46  void collect(const std::string& directory);
47 
48  virtual bool willLoad(const std::string &) override {
49  return true;
50  };
51 
52  virtual void load(BufferReader *reader, const std::string &filename) override;
53 
54 protected:
55  std::vector<AssetLoader *> m_loaders;
62  void processFiles(const std::vector<std::string> &files);
63 };
64 
65 #endif /* ASSETCOLLECTOR_H */
66 
AssetCollector::load
virtual void load(BufferReader *reader, const std::string &filename) override
Definition: AssetCollector.cpp:91
AssetCollector::willLoad
virtual bool willLoad(const std::string &) override
Definition: AssetCollector.h:48
AssetLoader
Definition: AssetLoader.h:24
npc_dialog.filename
filename
Definition: npc_dialog.py:99
AssetCollector::m_loaders
std::vector< AssetLoader * > m_loaders
Definition: AssetCollector.h:55
AssetCollector::collect
void collect(const std::string &directory)
Definition: AssetCollector.cpp:54
AssetCollector::m_reader
BufferReader * m_reader
Definition: AssetCollector.h:56
AssetCollector::AssetCollector
AssetCollector()
Definition: AssetCollector.cpp:29
AssetCollector::processFiles
void processFiles(const std::vector< std::string > &files)
Definition: AssetCollector.cpp:40
AssetCollector::addLoader
void addLoader(AssetLoader *loader)
Definition: AssetCollector.h:40
AssetCollector::~AssetCollector
virtual ~AssetCollector()
Definition: AssetCollector.cpp:33
AssetCollector
Definition: AssetCollector.h:24
BufferReader
Definition: bufferreader.cpp:21
AssetLoader.h