| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "profilepartxmlparserprovider.h" |
| 5 | |
| 6 | #include <utility> |
| 7 | |
| 8 | std::unordered_map<std::string, |
| 9 | std::function<std::unique_ptr<IProfilePartXMLParser>()>> const & |
| 10 | ProfilePartXMLParserProvider::profilePartParserProviders() const |
| 11 | { |
| 12 | return profilePartParserProviders_(); |
| 13 | } |
| 14 | |
| 15 | std::unordered_map<std::string, |
| 16 | std::function<std::unique_ptr<IProfilePartXMLParser>()>> & |
| 17 | ProfilePartXMLParserProvider::profilePartParserProviders_() |
| 18 | { |
| 19 | static std::unordered_map< |
| 20 | std::string, std::function<std::unique_ptr<IProfilePartXMLParser>()>> |
| 21 | providers; |
| 22 | return providers; |
| 23 | } |
| 24 | |
| 25 | bool ProfilePartXMLParserProvider::registerProvider( |
| 26 | std::string_view componentID, |
| 27 | std::function<std::unique_ptr<IProfilePartXMLParser>()> &&provider) |
| 28 | { |
| 29 | profilePartParserProviders_().emplace(std::string(componentID), |
| 30 | std::move(provider)); |
| 31 | return true; |
| 32 | } |