diff --git a/inc/hgl/assets/AssetsSource.h b/inc/hgl/assets/AssetsSource.h index 80ec230..c5702fb 100644 --- a/inc/hgl/assets/AssetsSource.h +++ b/inc/hgl/assets/AssetsSource.h @@ -50,8 +50,6 @@ namespace hgl */ class AssetsSource { - protected: - UTF8String uri_short_name; public: @@ -74,12 +72,9 @@ namespace hgl virtual AssetsSource * CreateSubSource (const UTF8String &){return nullptr;} };//class AssetsSource - AssetsSource *CreateByFilesystem(const UTF8String &sn,const OSString &pathname,const bool only_read); + AssetsSource *CreateSourceByFilesystem(const UTF8String &sn,const OSString &pathname,const bool only_read); - bool RegistryAssetsSource(const UTF8String &uri_short_name,AssetsSource *); - void UnregistryAssetsSource(const UTF8String &uri_short_name); - - AssetsSource *GetAssetsSource(const UTF8String &uri_short_name); + AssetsSource *GetSource(const UTF8String &uri_short_name); io::InputStream *GetAssets(const UTF8String &uri); }//namespace assets diff --git a/src/AssetsSource.cpp b/src/AssetsSource.cpp index 742d7ca..3ba4983 100644 --- a/src/AssetsSource.cpp +++ b/src/AssetsSource.cpp @@ -9,17 +9,6 @@ namespace hgl { Map assets_source_map; }//namespace - - AssetsSource::AssetsSource(const UTF8String &sn) - { - uri_short_name=sn; - RegistryAssetsSource(sn,this); - } - - AssetsSource::~AssetsSource() - { - UnregistryAssetsSource(uri_short_name); - } bool RegistryAssetsSource(const UTF8String &uri_short_name,AssetsSource *as) { @@ -44,7 +33,7 @@ namespace hgl assets_source_map.DeleteByKey(uri_short_name); } - AssetsSource *GetAssetsSource(const UTF8String &uri_short_name) + AssetsSource *GetSource(const UTF8String &uri_short_name) { if(uri_short_name.IsEmpty()) return(nullptr); @@ -55,7 +44,7 @@ namespace hgl return as; return(nullptr); - } + } io::InputStream *GetAssets(const UTF8String &uri) { @@ -68,8 +57,8 @@ namespace hgl const UTF8String sn=uri.SubString(0,pos); - AssetsSource *source=GetAssetsSource(sn); - + AssetsSource *source=GetSource(uri); + if(!source) return(nullptr); @@ -77,5 +66,16 @@ namespace hgl return source->OpenByName(surl); } + + AssetsSource::AssetsSource(const UTF8String &sn) + { + uri_short_name=sn; + RegistryAssetsSource(sn,this); + } + + AssetsSource::~AssetsSource() + { + UnregistryAssetsSource(uri_short_name); + } }//namespace assets }//namespace hgl \ No newline at end of file diff --git a/src/AssetsSourceFilesystem.cpp b/src/AssetsSourceFilesystem.cpp index db36c94..83c7253 100644 --- a/src/AssetsSourceFilesystem.cpp +++ b/src/AssetsSourceFilesystem.cpp @@ -39,7 +39,7 @@ namespace hgl } };//class AssetsSourceFilesytem:public AssetsSource - AssetsSource *CreateByFilesystem(const OSString &path,const bool only_read) + AssetsSource *CreateSourceByFilesystem(const OSString &path,const bool only_read) { if(path.IsEmpty()) return(nullptr);