radio_tool 0.2.1
Loading...
Searching...
No Matches
codeplug_factory.hpp
1
18#pragma once
19
20#include <radio_tool/codeplug/codeplug.hpp>
21#include <radio_tool/codeplug/rdt.hpp>
22
23#include <string>
24#include <memory>
25#include <functional>
26
28{
32 const std::vector<std::pair<std::function<bool(const std::string &)>, std::function<std::unique_ptr<CodeplugSupport>()>>> AllCodeplugs = {
33 {RDT::SupportsCodeplug, RDT::Create}
34 };
35
37 {
38 public:
39 static auto GetCodeplugHandler(const std::string &file) -> std::unique_ptr<CodeplugSupport>
40 {
41 for (const auto &try_this : AllCodeplugs)
42 {
43 if (try_this.first(file))
44 {
45 return try_this.second();
46 }
47 }
48
49 return nullptr;
50 }
51 };
52} // namespace radio_tool::codeplug
const std::vector< std::pair< std::function< bool(const std::string &)>, std::function< std::unique_ptr< CodeplugSupport >()> > > AllCodeplugs