Skip to content

Commit fe3b321

Browse files
authored
Merge pull request #269 from ursfassler/remove-boost-multi_array
remove boost::multi_array
2 parents 8129e0a + d0e66f0 commit fe3b321

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

include/cucumber-cpp/internal/CukeEngine.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include <string>
66
#include <vector>
77

8-
#include <boost/multi_array.hpp>
9-
108
#include <cucumber-cpp/internal/CukeExport.hpp>
119

1210
namespace cucumber {
@@ -65,7 +63,7 @@ class CUCUMBER_CPP_EXPORT PendingStepException : public InvokeException {
6563
class CukeEngine {
6664
private:
6765
typedef std::vector<std::string> string_array;
68-
typedef boost::multi_array<std::string, 2> string_2d_array;
66+
typedef std::vector<std::vector<std::string>> string_2d_array;
6967

7068
public:
7169
typedef string_array tags_type;

src/CukeEngineImpl.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,22 @@ void CukeEngineImpl::beginScenario(const tags_type& tags) {
4545
void CukeEngineImpl::invokeStep(
4646
const std::string& id, const invoke_args_type& args, const invoke_table_type& tableArg
4747
) {
48-
typedef invoke_table_type::index table_index;
49-
5048
InvokeArgs commandArgs;
5149
try {
5250
for (const std::string& a : args) {
5351
commandArgs.addArg(a);
5452
}
5553

56-
if (tableArg.shape()[0] > 1 && tableArg.shape()[1] > 0) {
54+
if (!tableArg.empty() && !tableArg.front().empty()) {
5755
Table& commandTableArg = commandArgs.getVariableTableArg();
58-
for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) {
59-
commandTableArg.addColumn(tableArg[0][j]);
56+
for (const auto& arg : tableArg[0]) {
57+
commandTableArg.addColumn(arg);
6058
}
6159

62-
for (table_index i = 1; i < table_index(tableArg.shape()[0]); ++i) {
60+
for (std::size_t i = 1; i < tableArg.size(); ++i) {
6361
Table::row_type row;
64-
for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) {
65-
row.push_back(tableArg[i][j]);
62+
for (const auto& arg : tableArg[i]) {
63+
row.push_back(arg);
6664
}
6765
commandTableArg.addRow(row);
6866
}

src/connectors/wire/WireProtocol.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ void fillTableArg(const mArray& jsonTableArg, CukeEngine::invoke_table_type& tab
112112
size_type rows = jsonTableArg.size();
113113
if (rows > 0) {
114114
size_type columns = jsonTableArg[0].get_array().size();
115-
tableArg.resize(boost::extents[rows][columns]);
115+
tableArg.resize(rows);
116116
for (size_type i = 0; i < rows; ++i) {
117117
const mArray& jsonRow(jsonTableArg[i].get_array());
118118
if (jsonRow.size() == columns) {
119119
for (size_type j = 0; j < columns; ++j) {
120-
tableArg[i][j] = jsonRow[j].get_str();
120+
tableArg[i].push_back(jsonRow[j].get_str());
121121
}
122122
} else {
123123
// TODO: Invalid row
@@ -257,7 +257,7 @@ class WireResponseEncoder : public WireResponseVisitor {
257257
for (const StepMatchArg& ma : m.args) {
258258
mObject jsonMa;
259259
jsonMa["val"] = ma.value;
260-
jsonMa["pos"] = static_cast<boost::int64_t>(ma.position);
260+
jsonMa["pos"] = static_cast<int64_t>(ma.position);
261261
jsonArgs.push_back(jsonMa);
262262
}
263263
jsonM["args"] = jsonArgs;

0 commit comments

Comments
 (0)