1 #include "api_action.h"
4 #include "parser_state.h"
6 SGCONF::PARSER_STATE SGCONF::API_ACTION::Parse(int argc, char ** argv, void * /*data*/)
8 PARSER_STATE state(false, argc, argv);
9 if (!m_argument.empty())
14 throw ERROR("Missing argument.");
19 state = m_suboptions.Parse(state.argc, state.argv, &m_params);
20 m_commands.Add(m_funPtr, m_argument, m_params);
24 SGCONF::API_ACTION::API_ACTION(COMMANDS & commands,
25 const std::string & paramDescription,
27 const std::vector<PARAM> & params,
29 : m_commands(commands),
30 m_description(paramDescription),
31 m_argument(needArgument ? "1" : ""), // Hack
34 std::vector<PARAM>::const_iterator it(params.begin());
35 while (it != params.end())
37 m_suboptions.Add(it->name, MakeKVAction(it->name, it->shortDescr), it->longDescr);