Skip to content

remove boost::multi_array #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions include/cucumber-cpp/internal/CukeEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <string>
#include <vector>

#include <boost/multi_array.hpp>

#include <cucumber-cpp/internal/CukeExport.hpp>

namespace cucumber {
Expand Down Expand Up @@ -65,7 +63,7 @@ class CUCUMBER_CPP_EXPORT PendingStepException : public InvokeException {
class CukeEngine {
private:
typedef std::vector<std::string> string_array;
typedef boost::multi_array<std::string, 2> string_2d_array;
typedef std::vector<std::vector<std::string>> string_2d_array;

public:
typedef string_array tags_type;
Expand Down
14 changes: 6 additions & 8 deletions src/CukeEngineImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,22 @@ void CukeEngineImpl::beginScenario(const tags_type& tags) {
void CukeEngineImpl::invokeStep(
const std::string& id, const invoke_args_type& args, const invoke_table_type& tableArg
) {
typedef invoke_table_type::index table_index;

InvokeArgs commandArgs;
try {
for (const std::string& a : args) {
commandArgs.addArg(a);
}

if (tableArg.shape()[0] > 1 && tableArg.shape()[1] > 0) {
if (!tableArg.empty() && !tableArg.front().empty()) {
Table& commandTableArg = commandArgs.getVariableTableArg();
for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) {
commandTableArg.addColumn(tableArg[0][j]);
for (const auto& arg : tableArg[0]) {
commandTableArg.addColumn(arg);
}

for (table_index i = 1; i < table_index(tableArg.shape()[0]); ++i) {
for (std::size_t i = 1; i < tableArg.size(); ++i) {
Table::row_type row;
for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) {
row.push_back(tableArg[i][j]);
for (const auto& arg : tableArg[i]) {
row.push_back(arg);
}
commandTableArg.addRow(row);
}
Expand Down
6 changes: 3 additions & 3 deletions src/connectors/wire/WireProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ void fillTableArg(const mArray& jsonTableArg, CukeEngine::invoke_table_type& tab
size_type rows = jsonTableArg.size();
if (rows > 0) {
size_type columns = jsonTableArg[0].get_array().size();
tableArg.resize(boost::extents[rows][columns]);
tableArg.resize(rows);
for (size_type i = 0; i < rows; ++i) {
const mArray& jsonRow(jsonTableArg[i].get_array());
if (jsonRow.size() == columns) {
for (size_type j = 0; j < columns; ++j) {
tableArg[i][j] = jsonRow[j].get_str();
tableArg[i].push_back(jsonRow[j].get_str());
}
} else {
// TODO: Invalid row
Expand Down Expand Up @@ -257,7 +257,7 @@ class WireResponseEncoder : public WireResponseVisitor {
for (const StepMatchArg& ma : m.args) {
mObject jsonMa;
jsonMa["val"] = ma.value;
jsonMa["pos"] = static_cast<boost::int64_t>(ma.position);
jsonMa["pos"] = static_cast<int64_t>(ma.position);
jsonArgs.push_back(jsonMa);
}
jsonM["args"] = jsonArgs;
Expand Down