aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--utils/aes_block_common.hpp54
-rw-r--r--utils/aes_file_common.hpp36
2 files changed, 45 insertions, 45 deletions
diff --git a/utils/aes_block_common.hpp b/utils/aes_block_common.hpp
index 0a5e1d8..bdb6ac6 100644
--- a/utils/aes_block_common.hpp
+++ b/utils/aes_block_common.hpp
@@ -65,30 +65,30 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const std::string& program_name)
- : m_program_name(program_name)
- , m_options("Options")
- , m_boxes(false)
- , m_verbose(false)
+ CommandLineParser(const std::string& prog_name)
+ : prog_name(prog_name)
+ , options("Options")
+ , boxes_flag(false)
+ , verbose_flag(false)
{ }
bool parse_options(int argc, char** argv)
{
namespace po = boost::program_options;
- m_options.add_options()
+ options.add_options()
("help,h", "show this message and exit")
- ("box,b", po::bool_switch(&m_boxes)->default_value(false), "use the \"boxes\" interface")
- ("mode,m", po::value<aesni::Mode>(&m_mode)->required(), "set mode of operation")
- ("algorithm,a", po::value<aesni::Algorithm>(&m_algorithm)->required(), "set algorithm")
- ("verbose,v", po::bool_switch(&m_verbose)->default_value(false), "enable verbose output");
+ ("box,b", po::bool_switch(&boxes_flag)->default_value(false), "use the \"boxes\" interface")
+ ("mode,m", po::value<aesni::Mode>(&encryption_mode)->required(), "set mode of operation")
+ ("algorithm,a", po::value<aesni::Algorithm>(&encryption_algo)->required(), "set algorithm")
+ ("verbose,v", po::bool_switch(&verbose_flag)->default_value(false), "enable verbose output");
po::options_description hidden_options;
hidden_options.add_options()
- ("positional", po::value<std::vector<std::string>>(&m_args));
+ ("positional", po::value<std::vector<std::string>>(&args));
po::options_description all_options;
- all_options.add(m_options).add(hidden_options);
+ all_options.add(options).add(hidden_options);
po::positional_options_description positional_options;
positional_options.add("positional", -1);
@@ -108,44 +108,44 @@ namespace
void print_usage()
{
- std::cout << "Usage: " << m_program_name << " [OPTIONS...] [-- KEY [IV] [BLOCK...]...]\n";
- std::cout << m_options << "\n";
+ std::cout << "Usage: " << prog_name << " [OPTIONS...] [-- KEY [IV] [BLOCK...]...]\n";
+ std::cout << options << "\n";
}
aesni::Mode get_mode() const
{
- return m_mode;
+ return encryption_mode;
}
aesni::Algorithm get_algorithm() const
{
- return m_algorithm;
+ return encryption_algo;
}
bool use_boxes() const
{
- return m_boxes;
+ return boxes_flag;
}
std::deque<std::string> get_args()
{
- return { std::make_move_iterator(m_args.begin()), std::make_move_iterator(m_args.end()) };
+ return { std::make_move_iterator(args.begin()), std::make_move_iterator(args.end()) };
}
bool verbose() const
{
- return m_verbose;
+ return verbose_flag;
}
private:
- const std::string m_program_name;
- boost::program_options::options_description m_options;
-
- aesni::Mode m_mode;
- aesni::Algorithm m_algorithm;
- bool m_boxes;
- std::vector<std::string> m_args;
- bool m_verbose;
+ const std::string prog_name;
+ boost::program_options::options_description options;
+
+ aesni::Mode encryption_mode;
+ aesni::Algorithm encryption_algo;
+ bool boxes_flag;
+ std::vector<std::string> args;
+ bool verbose_flag;
};
}
diff --git a/utils/aes_file_common.hpp b/utils/aes_file_common.hpp
index 28e16df..8a13b48 100644
--- a/utils/aes_file_common.hpp
+++ b/utils/aes_file_common.hpp
@@ -63,26 +63,26 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const std::string& program_name)
- : m_program_name(program_name)
- , m_options("Options")
+ CommandLineParser(const std::string& prog_name)
+ : prog_name(prog_name)
+ , options("Options")
{ }
bool parse_options(int argc, char** argv)
{
namespace po = boost::program_options;
- m_options.add_options()
+ options.add_options()
("help,h", "show this message and exit")
- ("mode,m", po::value<aesni::Mode>(&m_mode)->required(), "set mode of operation")
- ("algorithm,a", po::value<aesni::Algorithm>(&m_algorithm)->required(), "set algorithm");
+ ("mode,m", po::value<aesni::Mode>(&encryption_mode)->required(), "set mode of operation")
+ ("algorithm,a", po::value<aesni::Algorithm>(&encryption_algo)->required(), "set algorithm");
po::options_description hidden_options;
hidden_options.add_options()
- ("positional", po::value<std::vector<std::string>>(&m_args));
+ ("positional", po::value<std::vector<std::string>>(&args));
po::options_description all_options;
- all_options.add(m_options).add(hidden_options);
+ all_options.add(options).add(hidden_options);
po::positional_options_description positional_options;
positional_options.add("positional", -1);
@@ -102,31 +102,31 @@ namespace
void print_usage()
{
- std::cout << "Usage: " << m_program_name << " [OPTIONS...] KEY [IV] SRC_PATH DEST_PATH\n";
- std::cout << m_options << "\n";
+ std::cout << "Usage: " << prog_name << " [OPTIONS...] KEY [IV] SRC_PATH DEST_PATH\n";
+ std::cout << options << "\n";
}
aesni::Mode get_mode() const
{
- return m_mode;
+ return encryption_mode;
}
aesni::Algorithm get_algorithm() const
{
- return m_algorithm;
+ return encryption_algo;
}
std::deque<std::string> get_args()
{
- return { std::make_move_iterator(m_args.begin()), std::make_move_iterator(m_args.end()) };
+ return { std::make_move_iterator(args.begin()), std::make_move_iterator(args.end()) };
}
private:
- const std::string m_program_name;
- boost::program_options::options_description m_options;
+ const std::string prog_name;
+ boost::program_options::options_description options;
- aesni::Mode m_mode;
- aesni::Algorithm m_algorithm;
- std::vector<std::string> m_args;
+ aesni::Mode encryption_mode;
+ aesni::Algorithm encryption_algo;
+ std::vector<std::string> args;
};
}