From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- tests/common/RecordsParam.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/common/RecordsParam.h (limited to 'tests/common/RecordsParam.h') diff --git a/tests/common/RecordsParam.h b/tests/common/RecordsParam.h new file mode 100644 index 0000000..19d4532 --- /dev/null +++ b/tests/common/RecordsParam.h @@ -0,0 +1,58 @@ +#ifndef RECORDS_PARAM_H +#define RECORDS_PARAM_H + +#include +#include +#include +#include +#include + +class DicRecord; + +using std::vector; +using std::string; +using std::ostream; + +struct RecordsParam +{ +public: + static vector createParams(); + + template + static string vectorToStr(const vector& v); + + static vector hashToStrVector(const QHash& hash, + const vector& keys); + +public: + RecordsParam(vector packFields, vector > records, + vector questions, vector > answers); + + vector recordsToStr() const; + +public: + static const vector fieldNames; + +public: + QList records; + vector packFields; + vector questions; + vector > answers; +}; + +ostream& operator<<(ostream& os, const RecordsParam& param); + +template +string RecordsParam::vectorToStr(const vector& v) +{ + std::stringstream ss; + for(unsigned i = 0; i < v.size(); i++) + { + if(i != 0) + ss << ", "; + ss << v[i]; + } + return ss.str(); +} + +#endif -- cgit