update String<> names

This commit is contained in:
hyzboy 2025-01-04 14:14:19 +08:00
parent cf6a54d484
commit 878335ba9c
3 changed files with 19 additions and 19 deletions

View File

@ -46,15 +46,15 @@ namespace hgl
*/ */
class AssetsSource class AssetsSource
{ {
UTF8String uri_short_name; U8String uri_short_name;
public: public:
const UTF8String &GetURI()const{return uri_short_name;} const U8String &GetURI()const{return uri_short_name;}
public: public:
AssetsSource(const UTF8String &); AssetsSource(const U8String &);
virtual ~AssetsSource(); virtual ~AssetsSource();
virtual bool hasAnonymousAccess ()const{return false;} virtual bool hasAnonymousAccess ()const{return false;}
@ -64,15 +64,15 @@ namespace hgl
public: public:
virtual io::InputStream * Open (const UTF8String &){return nullptr;} virtual io::InputStream * Open (const U8String &){return nullptr;}
virtual AssetsSource * CreateSubSource (const UTF8String &){return nullptr;} virtual AssetsSource * CreateSubSource (const U8String &){return nullptr;}
};//class AssetsSource };//class AssetsSource
AssetsSource *CreateSourceByFilesystem(const UTF8String &sn,const OSString &pathname,const bool only_read); AssetsSource *CreateSourceByFilesystem(const U8String &sn,const OSString &pathname,const bool only_read);
AssetsSource *GetSource(const UTF8String &uri_short_name); AssetsSource *GetSource(const U8String &uri_short_name);
io::InputStream *GetAssets(const UTF8String &uri); io::InputStream *GetAssets(const U8String &uri);
}//namespace assets }//namespace assets
}//namespace hgl }//namespace hgl
#endif//HGL_ASSETS_SOURCE_INCLUDE #endif//HGL_ASSETS_SOURCE_INCLUDE

View File

@ -7,10 +7,10 @@ namespace hgl
{ {
namespace namespace
{ {
Map<UTF8String,AssetsSource *> assets_source_map; Map<U8String,AssetsSource *> assets_source_map;
}//namespace }//namespace
bool RegistryAssetsSource(const UTF8String &uri_short_name,AssetsSource *as) bool RegistryAssetsSource(const U8String &uri_short_name,AssetsSource *as)
{ {
if(!as) if(!as)
return(false); return(false);
@ -25,7 +25,7 @@ namespace hgl
return(true); return(true);
} }
void UnregistryAssetsSource(const UTF8String &uri_short_name) void UnregistryAssetsSource(const U8String &uri_short_name)
{ {
if(uri_short_name.IsEmpty()) if(uri_short_name.IsEmpty())
return; return;
@ -33,7 +33,7 @@ namespace hgl
assets_source_map.DeleteByKey(uri_short_name); assets_source_map.DeleteByKey(uri_short_name);
} }
AssetsSource *GetSource(const UTF8String &uri_short_name) AssetsSource *GetSource(const U8String &uri_short_name)
{ {
if(uri_short_name.IsEmpty()) if(uri_short_name.IsEmpty())
return(nullptr); return(nullptr);
@ -46,7 +46,7 @@ namespace hgl
return(nullptr); return(nullptr);
} }
io::InputStream *GetAssets(const UTF8String &uri) io::InputStream *GetAssets(const U8String &uri)
{ {
int pos=uri.FindChar(':'); int pos=uri.FindChar(':');
@ -55,19 +55,19 @@ namespace hgl
if(uri.Comp(pos,u8"://",3)) if(uri.Comp(pos,u8"://",3))
return(nullptr); return(nullptr);
const UTF8String sn=uri.SubString(0,pos); const U8String sn=uri.SubString(0,pos);
AssetsSource *source=GetSource(uri); AssetsSource *source=GetSource(uri);
if(!source) if(!source)
return(nullptr); return(nullptr);
const UTF8String surl=uri.SubString(pos+3); const U8String surl=uri.SubString(pos+3);
return source->Open(surl); return source->Open(surl);
} }
AssetsSource::AssetsSource(const UTF8String &sn) AssetsSource::AssetsSource(const U8String &sn)
{ {
uri_short_name=sn; uri_short_name=sn;
RegistryAssetsSource(sn,this); RegistryAssetsSource(sn,this);

View File

@ -14,7 +14,7 @@ namespace hgl
public: public:
AssetsSourceFilesytem(const UTF8String &sn,const OSString &path,const bool _or):AssetsSource(sn) AssetsSourceFilesytem(const U8String &sn,const OSString &path,const bool _or):AssetsSource(sn)
{ {
root_path=path; root_path=path;
only_read=_or; only_read=_or;
@ -22,7 +22,7 @@ namespace hgl
bool hasNameAccess()const override{return true;} bool hasNameAccess()const override{return true;}
io::InputStream *Open(const UTF8String &filename) io::InputStream *Open(const U8String &filename)
{ {
const OSString &fullname=filesystem::MergeFilename(root_path,ToOSString(filename)); const OSString &fullname=filesystem::MergeFilename(root_path,ToOSString(filename));
@ -39,7 +39,7 @@ namespace hgl
} }
};//class AssetsSourceFilesytem:public AssetsSource };//class AssetsSourceFilesytem:public AssetsSource
AssetsSource *CreateSourceByFilesystem(const UTF8String &uri,const OSString &path,const bool only_read) AssetsSource *CreateSourceByFilesystem(const U8String &uri,const OSString &path,const bool only_read)
{ {
if(!uri.IsEmpty()) if(!uri.IsEmpty())
{ {