diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-12-27 01:04:31 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-12-27 01:04:31 +0300 |
commit | 766bc9300819f52c2a741b8773e56afae2e75ef1 (patch) | |
tree | 77049f8d2260b23c7391d99b07fde7c9d1845bca /utils | |
parent | cxx: refactoring (diff) | |
download | aes-tools-766bc9300819f52c2a741b8773e56afae2e75ef1.tar.gz aes-tools-766bc9300819f52c2a741b8773e56afae2e75ef1.zip |
code style
Diffstat (limited to '')
-rw-r--r-- | utils/block_cmd_parser.hpp | 5 | ||||
-rw-r--r-- | utils/data_parsers.hpp | 16 | ||||
-rw-r--r-- | utils/file_cmd_parser.hpp | 5 |
3 files changed, 22 insertions, 4 deletions
diff --git a/utils/block_cmd_parser.hpp b/utils/block_cmd_parser.hpp index 50334e7..708c241 100644 --- a/utils/block_cmd_parser.hpp +++ b/utils/block_cmd_parser.hpp @@ -71,7 +71,10 @@ namespace positional_options.add("positional", -1); po::variables_map vm; - po::store(po::command_line_parser(argc, argv).options(all_options).positional(positional_options).run(), vm); + po::store(po::command_line_parser(argc, argv) + .options(all_options) + .positional(positional_options) + .run(), vm); if (vm.count("help")) { diff --git a/utils/data_parsers.hpp b/utils/data_parsers.hpp index 08486fa..433ade3 100644 --- a/utils/data_parsers.hpp +++ b/utils/data_parsers.hpp @@ -18,6 +18,8 @@ static std::istream& operator>>(std::istream& is, aesni::Mode& dest) { + static const char* const argument_name = "mode"; + std::string src; is >> src; @@ -32,13 +34,19 @@ static std::istream& operator>>(std::istream& is, aesni::Mode& dest) else if (boost::iequals(src, "ctr")) dest = AESNI_CTR; else - throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value, "mode", src); + { + throw boost::program_options::validation_error( + boost::program_options::validation_error::invalid_option_value, + argument_name, src); + } return is; } static std::istream& operator>>(std::istream& is, aesni::Algorithm& dest) { + static const char* const argument_name = "algorithm"; + std::string src; is >> src; @@ -49,7 +57,11 @@ static std::istream& operator>>(std::istream& is, aesni::Algorithm& dest) else if (boost::iequals(src, "aes256")) dest = AESNI_AES256; else - throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value, "algorithm", src); + { + throw boost::program_options::validation_error( + boost::program_options::validation_error::invalid_option_value, + argument_name, src); + } return is; } diff --git a/utils/file_cmd_parser.hpp b/utils/file_cmd_parser.hpp index 78162a6..15b6a45 100644 --- a/utils/file_cmd_parser.hpp +++ b/utils/file_cmd_parser.hpp @@ -75,7 +75,10 @@ namespace positional_options.add("positional", -1); po::variables_map vm; - po::store(po::command_line_parser(argc, argv).options(all_options).positional(positional_options).run(), vm); + po::store(po::command_line_parser(argc, argv) + .options(all_options) + .positional(positional_options) + .run(), vm); if (vm.count("help")) { |