Merge pull request #26350 from jjd-uk/estuary_media_align
[xbmc.git] / xbmc / guilib / listproviders / MultiProvider.h
blob76887083f2c7a00841445b391aedfc63a1be85f6
1 /*
2 * Copyright (C) 2013-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "IListProvider.h"
12 #include "threads/CriticalSection.h"
14 #include <map>
15 #include <vector>
17 typedef std::unique_ptr<IListProvider> IListProviderPtr;
19 class TiXmlNode;
21 /*!
22 \ingroup listproviders
23 \brief A listprovider that handles multiple individual providers.
25 class CMultiProvider : public IListProvider
27 public:
28 CMultiProvider(const TiXmlNode *first, int parentID);
29 explicit CMultiProvider(const CMultiProvider& other);
31 // Implementation of IListProvider
32 std::unique_ptr<IListProvider> Clone() override;
33 bool Update(bool forceRefresh) override;
34 void Fetch(std::vector<std::shared_ptr<CGUIListItem>>& items) override;
35 bool IsUpdating() const override;
36 void Reset() override;
37 bool OnClick(const std::shared_ptr<CGUIListItem>& item) override;
38 bool OnInfo(const std::shared_ptr<CGUIListItem>& item) override;
39 bool OnContextMenu(const std::shared_ptr<CGUIListItem>& item) override;
41 protected:
42 typedef size_t item_key_type;
43 static item_key_type GetItemKey(std::shared_ptr<CGUIListItem> const& item);
44 std::vector<IListProviderPtr> m_providers;
45 std::map<item_key_type, IListProvider*> m_itemMap;
46 CCriticalSection m_section; // protects m_itemMap