| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "profilexmlparserfactory.h" |
| 5 | |
| 6 | #include "iprofile.h" |
| 7 | #include "iprofileparser.h" |
| 8 | #include "iprofilepartxmlparserprovider.h" |
| 9 | #include "profilexmlparser.h" |
| 10 | #include <utility> |
| 11 | |
| 12 | ProfileXMLParserFactory::ProfileXMLParserFactory( |
| 13 | std::unique_ptr<IProfilePartXMLParserProvider> &&profilePartParserProvider) noexcept |
| 14 | : profilePartParserProvider_(std::move(profilePartParserProvider)) |
| 15 | { |
| 16 | } |
| 17 | |
| 18 | std::unique_ptr<IProfileParser> |
| 19 | ProfileXMLParserFactory::build(IProfile const &baseProfile) const |
| 20 | { |
| 21 | auto parser = std::make_unique<ProfileXMLParser>(); |
| 22 | ProfileXMLParser::Factory parserFactory(*profilePartParserProvider_, *parser); |
| 23 | baseProfile.exportWith(parserFactory); |
| 24 | return std::move(parser); |
| 25 | } |