coming
天行健 君子以自强不息
记录我的成长
文章目录
该类管理并访问音乐资料库(本地+远程),定义于src/musikcore/library/LibraryFactory.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| class LibraryFactory { public: using LibraryVector = std::vector<ILibraryPtr>; using LibraryMap = std::map<int, ILibraryPtr>; using LibrariesUpdatedEvent = sigslot::signal0<>; using IMessageQueue = mymusic::core::runtime::IMessageQueue; LibrariesUpdatedEvent LibrariesUpdated; ~LibraryFactory(); static void Initialize(IMessageQueue& messageQueue); static LibraryFactory& Instance(); static void Shutdown(); ILibraryPtr DefaultLocalLibrary(); ILibraryPtr DefaultRemoteLibrary(); ILibraryPtr DefaultLibrary(ILibrary::Type type); LibraryVector Libraries();
ILibraryPtr CreateLibrary(const std::string& name, ILibrary::Type type); ILibraryPtr GetLibrary(int identifier);
private: LibraryFactory();
ILibraryPtr AddLibrary(int id, ILibrary::Type type, const std::string& name); LibraryVector libraries; LibraryMap libraryMap; };
|
关于CreateLibrary,其主要部分是根据情况调用LocalLibrary类或RemoteLibrary类的Create函数,下面详细介绍LocalLibrary类与RemoteLibrary类
本文代表个人观点,内容仅供参考。若有不恰当之处,望不吝赐教!