diff options
author | lloyd <[email protected]> | 2008-11-11 18:17:36 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-11 18:17:36 +0000 |
commit | 237258e42f4b1b8c01d91518270c4a9c59a0dc47 (patch) | |
tree | 4fbea59fc932e0b08c5e0e73b906be913811c216 /src | |
parent | 6a1e19928007c0047518e8e15b92bba116bf7a58 (diff) |
Remove support for multiple providers in SCAN_Name, mostly because I
couldn't really figure out how the semantics should work.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/scan_name.cpp | 28 | ||||
-rw-r--r-- | src/utils/scan_name.h | 23 |
2 files changed, 19 insertions, 32 deletions
diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp index b90211dea..e32110740 100644 --- a/src/utils/scan_name.cpp +++ b/src/utils/scan_name.cpp @@ -41,34 +41,12 @@ parse_and_deref_aliases(const std::string& algo_spec) } SCAN_Name::SCAN_Name(const std::string& algo_spec, - const std::string& prov_names) + const std::string& provider) { orig_algo_spec = algo_spec; - orig_providers = prov_names; + m_provider = provider; name = parse_and_deref_aliases(algo_spec); - - if(prov_names.find(',') != std::string::npos) - { - std::vector<std::string> prov_names_vec = split_on(prov_names, ','); - for(u32bit i = 0; i != prov_names_vec.size(); ++i) - providers.insert(prov_names_vec[i]); - } - else if(prov_names != "") - providers.insert(prov_names); - } - -bool SCAN_Name::provider_allowed(const std::string& provider) const - { - // If not providers were specified by the user, then allow any; - // usually the source order will try to perfer one of the better - // ones first. - - // The core provider is always enabled - if(provider == "core" || providers.empty()) - return true; - - return (providers.find(provider) != providers.end()); } SCAN_Name SCAN_Name::arg(u32bit i) const @@ -76,7 +54,7 @@ SCAN_Name SCAN_Name::arg(u32bit i) const if(i > arg_count()) throw std::range_error("SCAN_Name::argument"); - return SCAN_Name(name[i+1], orig_providers); + return SCAN_Name(name[i+1], m_provider); } std::string SCAN_Name::arg_as_string(u32bit i) const diff --git a/src/utils/scan_name.h b/src/utils/scan_name.h index 22b7aa528..b01411c94 100644 --- a/src/utils/scan_name.h +++ b/src/utils/scan_name.h @@ -22,12 +22,22 @@ class SCAN_Name public: /** @param algo_spec A SCAN name - @param providers An optional list of providers (like "sse2,openssl,x86-64,core") + @param providers An optional provider name */ SCAN_Name(const std::string& algo_spec, const std::string& providers = ""); /** + @return the original input string + */ + std::string as_string() const { return orig_algo_spec; } + + /** + @return the provider name (or empty) + */ + std::string provider() const { return m_provider; } + + /** @return the algorithm name */ std::string algo_name() const { return name[0]; } @@ -41,7 +51,10 @@ class SCAN_Name @param provider a provider name @returns if this provider was allowed by the request */ - bool provider_allowed(const std::string& provider) const; + bool provider_allowed(const std::string& provider) const + { + return (m_provider == "" || m_provider == provider); + } /** @return if the number of arguments is between lower and upper @@ -66,13 +79,9 @@ class SCAN_Name @return the ith argument as a u32bit, or a default value */ u32bit arg_as_u32bit(u32bit i, u32bit def_value) const; - - std::string as_string() const { return orig_algo_spec; } - std::string providers_string() const { return orig_providers; } private: - std::string orig_algo_spec, orig_providers; + std::string orig_algo_spec, m_provider; std::vector<std::string> name; - std::set<std::string> providers; }; } |