Program Listing for File base_cli.hpp

Return to documentation for file (rcppsw/utils/base_cli.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <boost/program_options.hpp>
#include <string>

#include "rcppsw/rcppsw.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace bpo = boost::program_options;
namespace rcppsw::utils {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class base_cli {
 public:
  explicit base_cli(const std::string& mnemonic = "");
  virtual ~base_cli(void) = default;

  status_t parse(int argc, char** argv);

  virtual bool validate(void) { return true; }

  void print(void);

  const bpo::variables_map& vm(void) { return m_vm; }

  bpo::options_description* desc(void) { return &m_desc; }

  const std::string& prog_name(void) { return m_prog_name; }

 private:
  /* clang-format off */
  bpo::variables_map       m_vm{};
  bpo::options_description m_desc;
  std::string              m_prog_name{};
  std::string              m_base_output_dir{};
  /* clang-format on */
};

} /* namespace rcppsw::utils */