]> git.stg.codes - stg.git/blobdiff - projects/sgconf/api_action.cpp
Simplified module interfaces.
[stg.git] / projects / sgconf / api_action.cpp
diff --git a/projects/sgconf/api_action.cpp b/projects/sgconf/api_action.cpp
new file mode 100644 (file)
index 0000000..1ff0e59
--- /dev/null
@@ -0,0 +1,21 @@
+#include "api_action.h"
+
+#include "parser_state.h"
+
+SGCONF::PARSER_STATE SGCONF::API_ACTION::Parse(int argc, char ** argv)
+{
+PARSER_STATE state(false, argc, argv);
+if (!m_argument.empty())
+    {
+    if (argc == 0 ||
+        argv == NULL ||
+        *argv == NULL)
+        throw ERROR("Missing argument.");
+    m_argument = *argv;
+    --state.argc;
+    ++state.argv;
+    }
+m_suboptions.Parse(state.argc, state.argv);
+m_commands.Add(m_funPtr, m_argument, m_params);
+return state;
+}