41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
#pragma once
|
|
#include <map>
|
|
#include <string>
|
|
#include "Export.h"
|
|
|
|
class UNSWSC_DLL_EXPORT DataTransfer
|
|
{
|
|
private:
|
|
std::string temp_root;
|
|
std::map<std::string, bool> files;
|
|
|
|
public:
|
|
DataTransfer(const std::string& tr = "");
|
|
|
|
public:
|
|
void Init(const std::string& tr);
|
|
bool ItemExist(const std::string& file);
|
|
bool InsertItem(const std::string& file);
|
|
bool RemoveItem(const std::string& file);
|
|
bool ItemValidate(const std::string& file);
|
|
void DeactivateItem(const std::string& file);
|
|
bool CopyItemTo(const std::string& file, const std::string& dest_path);
|
|
bool CopyItemAS(const std::string& file, const std::string& dest);
|
|
|
|
public:
|
|
bool RemoveAllCacheFiles();
|
|
std::string MakePath(const std::string& file);
|
|
};
|
|
|
|
extern UNSWSC_DLL_EXPORT DataTransfer GlobalDataTransfer;
|
|
|
|
#define GDT_INIT(__tr__) GlobalDataTransfer.Init(__tr__)
|
|
#define GDT_ADDITEM(__file__) GlobalDataTransfer.InsertItem(__file__)
|
|
#define GDT_DELETEITEM(__file__) GlobalDataTransfer.RemoveItem(__file__)
|
|
#define GDT_ITEMEXIST(__file__) GlobalDataTransfer.ItemExist(__file__)
|
|
#define GDT_ITEMVALIDATE(__file__) GlobalDataTransfer.ItemValidate(__file__)
|
|
#define GDT_DEACTIVEITEM(__file__) GlobalDataTransfer.DeactivateItem(__file__)
|
|
#define GDT_GETFULLPATH(__file__ ) GlobalDataTransfer.MakePath(__file__)
|
|
#define GDT_CLEAR_ALL_CACHE() GlobalDataTransfer.RemoveAllCacheFiles()
|
|
#define GDT_COPY_TO(__file__, __dest_path__) GlobalDataTransfer.CopyItemTo(__file__, __dest_path__)
|
|
#define GDT_COPY_AS(__file__, __dest_path__) GlobalDataTransfer.CopyItemAS(__file__, __dest_path__) |