diff options
author | lloyd <[email protected]> | 2009-07-16 15:07:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-16 15:07:59 +0000 |
commit | bd58db8eb1384fe26222d021325382f57f178cc7 (patch) | |
tree | b54713202d613e88407279e5319a97126e894d2a /src/utils/scan_name.cpp | |
parent | 1172c616fa849af893c1935b8b1dee085f8aaac8 (diff) |
Move some files around to break up dependencies between directories
Diffstat (limited to 'src/utils/scan_name.cpp')
-rw-r--r-- | src/utils/scan_name.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp deleted file mode 100644 index ef771871d..000000000 --- a/src/utils/scan_name.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/** -SCAN Name Abstraction -(C) 2008 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/scan_name.h> -#include <botan/parsing.h> -#include <botan/libstate.h> -#include <stdexcept> - -namespace Botan { - -namespace { - -std::vector<std::string> -parse_and_deref_aliases(const std::string& algo_spec) - { - std::vector<std::string> parts = parse_algorithm_name(algo_spec); - std::vector<std::string> out; - - for(size_t i = 0; i != parts.size(); ++i) - { - std::string part_i = global_state().deref_alias(parts[i]); - - if(i == 0 && part_i.find_first_of(",()") != std::string::npos) - { - std::vector<std::string> parts_i = parse_and_deref_aliases(part_i); - - for(size_t j = 0; j != parts_i.size(); ++j) - out.push_back(parts_i[j]); - } - else - out.push_back(part_i); - } - - return out; - } - -} - -SCAN_Name::SCAN_Name(const std::string& algo_spec) - { - orig_algo_spec = algo_spec; - - name = parse_and_deref_aliases(algo_spec); - - if(name.size() == 0) - throw Decoding_Error("Bad SCAN name " + algo_spec); - } - -std::string SCAN_Name::arg(u32bit i) const - { - if(i >= arg_count()) - throw std::range_error("SCAN_Name::argument"); - return name[i+1]; - } - -std::string SCAN_Name::arg(u32bit i, const std::string& def_value) const - { - if(i >= arg_count()) - return def_value; - return name[i+1]; - } - -u32bit SCAN_Name::arg_as_u32bit(u32bit i, u32bit def_value) const - { - if(i >= arg_count()) - return def_value; - return to_u32bit(name[i+1]); - } - -} |