CMAssetsManage/inc/hgl/assets/AssetsSource.h

79 lines
2.2 KiB
C
Raw Normal View History

2020-01-12 19:33:39 +08:00
#ifndef HGL_ASSETS_SOURCE_INCLUDE
#define HGL_ASSETS_SOURCE_INCLUDE
2020-09-05 18:35:56 +08:00
#include<hgl/type/String.h>
2020-01-13 11:18:25 +08:00
2020-01-12 19:33:39 +08:00
namespace hgl
{
2020-01-13 11:18:25 +08:00
namespace io
{
class InputStream;
}//namespace io
namespace assets
2020-01-12 19:33:39 +08:00
{
2020-01-13 11:18:25 +08:00
/**
*
*/
enum class SourceType
{
Memory=0, ///<内存
Filesystem, ///<文件系统
Archive, ///<打包/压缩档
Database, ///<数据库
SaveDevice, ///<存储设备
StreamDevice, ///<流式设备(如摄像头、麦克风)
Network, ///<网络
2022-06-30 11:14:39 +08:00
ENUM_CLASS_RANGE(Memory,Network)
2020-01-13 11:18:25 +08:00
};//enum class SourceType
/**
*
*/
enum class IndexType
{
2022-06-30 11:14:39 +08:00
Anonymous=0, ///<匿名访问
Name, ///<字符串名称
ID, ///<ID
Position, ///<坐标访问(如图数据库)
2020-01-13 11:18:25 +08:00
2022-06-30 11:14:39 +08:00
ENUM_CLASS_RANGE(Anonymous,Position)
2020-01-13 11:18:25 +08:00
};//enum class IndexType
/**
*
*/
class AssetsSource
{
2025-01-07 12:34:01 +08:00
U8String uri_short_name;
2020-01-13 11:18:25 +08:00
public:
2025-01-07 12:34:01 +08:00
const U8String &GetURI()const{return uri_short_name;}
2020-01-13 11:18:25 +08:00
public:
2025-01-07 12:34:01 +08:00
AssetsSource(const U8String &);
2020-01-13 11:18:25 +08:00
virtual ~AssetsSource();
virtual bool hasAnonymousAccess ()const{return false;}
virtual bool hasNameAccess ()const{return false;}
virtual bool hasIDAccess ()const{return false;}
virtual bool hasPositionAccess ()const{return false;}
public:
2025-01-07 12:34:01 +08:00
virtual io::InputStream * Open (const U8String &){return nullptr;}
virtual AssetsSource * CreateSubSource (const U8String &){return nullptr;}
2020-01-13 11:18:25 +08:00
};//class AssetsSource
2025-01-07 12:34:01 +08:00
AssetsSource *CreateSourceByFilesystem(const U8String &sn,const OSString &pathname,const bool only_read);
2020-01-13 11:18:25 +08:00
2025-01-07 12:34:01 +08:00
AssetsSource *GetSource(const U8String &uri_short_name);
2020-01-13 11:18:25 +08:00
2025-01-07 12:34:01 +08:00
io::InputStream *GetAssets(const U8String &uri);
2020-01-13 11:18:25 +08:00
}//namespace assets
2020-01-12 19:33:39 +08:00
}//namespace hgl
#endif//HGL_ASSETS_SOURCE_INCLUDE