From 766bc9300819f52c2a741b8773e56afae2e75ef1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 27 Dec 2015 01:04:31 +0300 Subject: code style --- utils/block_cmd_parser.hpp | 5 ++++- utils/data_parsers.hpp | 16 ++++++++++++++-- utils/file_cmd_parser.hpp | 5 ++++- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'utils') 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")) { -- cgit v1.2.3