2015-04-30 23:15:25 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIDATAMANAGER_H
|
2015-04-24 19:55:30 +00:00
|
|
|
|
|
|
|
#include <MyGUI_DataManager.h>
|
|
|
|
|
2022-06-19 11:28:33 +00:00
|
|
|
#include <filesystem>
|
2022-05-16 22:58:24 +00:00
|
|
|
#include <string>
|
|
|
|
|
2022-07-18 18:49:50 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
2022-07-07 15:34:18 +00:00
|
|
|
|
2015-04-30 23:15:25 +00:00
|
|
|
namespace osgMyGUI
|
2015-04-24 19:55:30 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
class DataManager : public MyGUI::DataManager
|
|
|
|
{
|
|
|
|
public:
|
2022-07-18 18:54:00 +00:00
|
|
|
explicit DataManager(const std::string& path, const VFS::Manager* vfs);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2022-06-19 11:28:33 +00:00
|
|
|
void setResourcePath(const std::filesystem::path& path);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
/** Get data stream from specified resource name.
|
|
|
|
@param _name Resource name (usually file name).
|
|
|
|
*/
|
2021-12-16 18:48:10 +00:00
|
|
|
MyGUI::IDataStream* getData(const std::string& _name) const override;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
/** Free data stream.
|
|
|
|
@param _data Data stream.
|
|
|
|
*/
|
2020-10-16 18:18:54 +00:00
|
|
|
void freeData(MyGUI::IDataStream* _data) override;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
/** Is data with specified name exist.
|
|
|
|
@param _name Resource name.
|
|
|
|
*/
|
2021-12-16 18:48:10 +00:00
|
|
|
bool isDataExist(const std::string& _name) const override;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
/** Get all data names with names that matches pattern.
|
|
|
|
@param _pattern Pattern to match (for example "*.layout").
|
|
|
|
*/
|
2021-12-16 18:48:10 +00:00
|
|
|
const MyGUI::VectorString& getDataListNames(const std::string& _pattern) const override;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
/** Get full path to data.
|
|
|
|
@param _name Resource name.
|
|
|
|
@return Return full path to specified data.
|
|
|
|
*/
|
2023-08-07 10:43:30 +00:00
|
|
|
std::string getDataPath(const std::string& _name) const override;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-04-24 19:55:30 +00:00
|
|
|
private:
|
2022-06-19 11:28:33 +00:00
|
|
|
std::filesystem::path mResourcePath;
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2022-07-07 15:34:18 +00:00
|
|
|
const VFS::Manager* mVfs;
|
2015-04-24 19:55:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|