7 #ifndef NLOHMANN_PARSERS_H
8 #define NLOHMANN_PARSERS_H
21 const std::string& stamp_fieldname)
23 , _use_message_stamp(use_msg_stamp)
24 , _stamp_fieldname(stamp_fieldname)
29 bool parseMessageImpl(
double& timestamp);
40 const std::string& stamp_fieldname)
45 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
52 const std::string& stamp_fieldname)
57 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
64 const std::string& stamp_fieldname)
69 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
76 bool use_msg_stamp,
const std::string& stamp_fieldname)
81 bool parseMessage(
const MessageRef msg,
double& timestamp)
override;
87 #include <QVBoxLayout>
97 QGroupBox::setCheckable(
true);
98 QGroupBox::setChecked(
false);
99 lineedit =
new QLineEdit(
this);
100 QVBoxLayout* vbox =
new QVBoxLayout;
101 vbox->addSpacing(20);
102 vbox->addWidget(lineedit);
103 QGroupBox::setLayout(vbox);
107 qDebug() <<
"Destroying QCheckBoxClose";
116 _encoding = encoding;
117 _checkbox_use_timestamp =
new QCheckBoxClose(
"use field as timestamp if available");
121 template <
typename ParserT>
126 std::string timestamp_name = _checkbox_use_timestamp->lineedit->text().toStdString();
127 return std::make_shared<ParserT>(
128 topic_name,
data, _checkbox_use_timestamp->isChecked(), timestamp_name);
135 return _checkbox_use_timestamp;
146 QString prefix = QString(
"NlohmannParser.") + QString(encoding());
147 bool checked = settings.value(prefix +
".timestampEnabled",
false).toBool();
148 QString
field = settings.value(prefix +
".timestampFieldName",
"").toString();
150 _checkbox_use_timestamp->setChecked(checked);
151 _checkbox_use_timestamp->lineedit->setText(
field);
157 QString prefix = QString(
"NlohmannParser.") + QString(encoding());
158 settings.setValue(prefix +
".timestampEnabled", _checkbox_use_timestamp->isChecked());
159 settings.setValue(prefix +
".timestampFieldName",
160 _checkbox_use_timestamp->lineedit->text());
180 return createParserImpl<JSON_Parser>(topic_name,
data);
182 const char*
name()
const override
184 return "JSON_ParserFactory";
198 return createParserImpl<CBOR_Parser>(topic_name,
data);
200 const char*
name()
const override
202 return "CBOR_ParserFactory";
216 return createParserImpl<BSON_Parser>(topic_name,
data);
218 const char*
name()
const override
220 return "BSON_ParserFactory";
234 return createParserImpl<MessagePack_Parser>(topic_name,
data);
236 const char*
name()
const override
238 return "MessagePack_ParserFactory";
242 #endif // NLOHMANN_PARSERS_H