continue management portal
This commit is contained in:
@ -307,6 +307,13 @@ enum class provider_type : std::size_t {
|
||||
unknown,
|
||||
};
|
||||
|
||||
[[nodiscard]] auto
|
||||
provider_type_from_string(std::string_view type,
|
||||
provider_type default_type = provider_type::unknown)
|
||||
-> provider_type;
|
||||
|
||||
[[nodiscard]] auto provider_type_to_string(provider_type type) -> std::string;
|
||||
|
||||
#if defined(_WIN32)
|
||||
struct open_file_data final {
|
||||
PVOID directory_buffer{nullptr};
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "types/startup_exception.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
@ -191,4 +192,34 @@ auto api_error_to_string(const api_error &error) -> const std::string & {
|
||||
|
||||
return LOOKUP.at(error);
|
||||
}
|
||||
|
||||
auto provider_type_from_string(std::string_view type,
|
||||
provider_type default_type) -> provider_type {
|
||||
auto type_lower = utils::string::to_lower(std::string{type});
|
||||
if (type_lower == "encrypt") {
|
||||
return provider_type::encrypt;
|
||||
}
|
||||
|
||||
if (type_lower == "remote") {
|
||||
return provider_type::remote;
|
||||
}
|
||||
|
||||
if (type_lower == "s3") {
|
||||
return provider_type::s3;
|
||||
}
|
||||
|
||||
if (type_lower == "sia") {
|
||||
return provider_type::sia;
|
||||
}
|
||||
|
||||
if (type_lower == "unknown") {
|
||||
return provider_type::unknown;
|
||||
}
|
||||
|
||||
return default_type;
|
||||
}
|
||||
|
||||
auto provider_type_to_string(provider_type type) -> std::string {
|
||||
return app_config::get_provider_name(type);
|
||||
}
|
||||
} // namespace repertory
|
||||
|
Reference in New Issue
Block a user