Skip to content

Commit a2be212

Browse files
committed
Add writer for 2D array string case
1 parent aeccc28 commit a2be212

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Framework/Core/include/Framework/VariantJSONHelpers.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ struct VariantReader : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, Va
201201
return false;
202202
}
203203
if (states.top() == State::IN_DATA) {
204-
//no previous keys
204+
// no previous keys
205205
states.push(State::IN_KEY);
206206
currentKey = str;
207207
return true;
@@ -281,14 +281,14 @@ struct VariantReader : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>, Va
281281
return false;
282282
}
283283
if (states.top() == State::IN_ARRAY) {
284-
//finish up array
284+
// finish up array
285285
states.pop();
286286
if constexpr (isArray2D<V>() || isLabeledArray<V>()) {
287287
rows = elementCount;
288288
}
289289
return true;
290290
} else if (states.top() == State::IN_ROW) {
291-
//finish up row
291+
// finish up row
292292
states.pop();
293293
if constexpr (isArray2D<V>() || isLabeledArray<V>()) {
294294
cols = elementCount;
@@ -350,6 +350,8 @@ void writeVariant(std::ostream& o, Variant const& v)
350350
w.Int(array2d(i, j));
351351
} else if constexpr (std::is_same_v<float, T> || std::is_same_v<double, T>) {
352352
w.Double(array2d(i, j));
353+
} else if constexpr (std::is_same_v<std::string, T>) {
354+
w.String(array2d(i, j));
353355
}
354356
}
355357
w.EndArray();
@@ -447,6 +449,6 @@ struct VariantJSONHelpers {
447449
}
448450
}
449451
};
450-
}
452+
} // namespace o2::framework
451453

452454
#endif // FRAMEWORK_VARIANTJSONHELPERS_H

0 commit comments

Comments
 (0)