| 43 | } |
| 44 | |
| 45 | void CukeEngineImpl::invokeStep( |
| 46 | const std::string& id, const invoke_args_type& args, const invoke_table_type& tableArg |
| 47 | ) { |
| 48 | InvokeArgs commandArgs; |
| 49 | try { |
| 50 | for (const std::string& a : args) { |
| 51 | commandArgs.addArg(a); |
| 52 | } |
| 53 | |
| 54 | if (!tableArg.empty() && !tableArg.front().empty()) { |
| 55 | Table& commandTableArg = commandArgs.getVariableTableArg(); |
| 56 | for (const auto& arg : tableArg[0]) { |
| 57 | commandTableArg.addColumn(arg); |
| 58 | } |
| 59 | |
| 60 | for (std::size_t i = 1; i < tableArg.size(); ++i) { |
| 61 | Table::row_type row; |
| 62 | for (const auto& arg : tableArg[i]) { |
| 63 | row.push_back(arg); |
| 64 | } |
| 65 | commandTableArg.addRow(row); |
| 66 | } |
| 67 | } |
| 68 | } catch (...) { |
| 69 | throw InvokeException("Unable to decode arguments"); |
| 70 | } |
| 71 | |
| 72 | InvokeResult commandResult; |
| 73 | try { |
| 74 | commandResult = cukeCommands.invoke(convertId(id), &commandArgs); |
| 75 | } catch (...) { |
| 76 | throw InvokeException("Uncatched exception"); |
| 77 | } |
| 78 | switch (commandResult.getType()) { |
| 79 | case SUCCESS: |
| 80 | return; |
| 81 | case FAILURE: |
| 82 | throw InvokeFailureException(commandResult.getDescription(), ""); |
| 83 | case PENDING: |
| 84 | throw PendingStepException(commandResult.getDescription()); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | void CukeEngineImpl::endScenario(const tags_type& /*tags*/) { |
| 89 | cukeCommands.endScenario(); |