Botan 3.14.1
Crypto and TLS for C&
probe_providers.h
Go to the documentation of this file.
1/*
2* (C) 2015 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_PROBE_PROVIDERS_H_
8#define BOTAN_PROBE_PROVIDERS_H_
9
10#include <string>
11#include <string_view>
12#include <vector>
13
14namespace Botan {
15
16/**
17* Return those of the possible providers for which T::create succeeds
18*/
19template <typename T>
20std::vector<std::string> probe_providers_of(std::string_view algo_spec,
21 const std::vector<std::string>& possible = {"base"}) {
22 std::vector<std::string> providers;
23 for(auto&& prov : possible) {
24 const auto o = T::create(algo_spec, prov);
25 if(o) {
26 providers.push_back(prov); // available
27 }
28 }
29 return providers;
30}
31
32} // namespace Botan
33
34#endif
std::vector< std::string > probe_providers_of(std::string_view algo_spec, const std::vector< std::string > &possible={"base"})