Manak  2.0.0
cli.hpp
Go to the documentation of this file.
1 
7 #ifndef MANAK_UTIL_CLI_HPP_INCLUDED
8 #define MANAK_UTIL_CLI_HPP_INCLUDED
9 
10 #include <string>
11 #include <algorithm>
12 
13 namespace manak
14 {
15 namespace utils
16 {
17 namespace cli
18 {
19 
23 class CLI
24 {
25  public:
27  static char* getCmdOption(char ** begin,
28  char ** end,
29  const std::string & option)
30  {
31  char ** itr = std::find(begin, end, option);
32  if (itr != end && ++itr != end)
33  {
34  return *itr;
35  }
36  return 0;
37  }
38 
40  static bool cmdOptionExists(char** begin, char** end, const std::string& option)
41  {
42  return std::find(begin, end, option) != end;
43  }
44 }; // class CLI
45 
46 }; // namespace cli
47 }; // namespace utils
48 }; // namespace manak
49 
50 
51 #endif // MANAK_UTIL_CLI_HPP_INCLUDED
static char * getCmdOption(char **begin, char **end, const std::string &option)
Check if certain option is passed.
Definition: cli.hpp:27
static bool cmdOptionExists(char **begin, char **end, const std::string &option)
Get passed option.
Definition: cli.hpp:40
Command Line Interface.
Definition: cli.hpp:23