libdballe 9.13
json_codec.h
1#ifndef DBALLE_MSG_JSON_CODEC_H
2#define DBALLE_MSG_JSON_CODEC_H
3
4#include <dballe/core/fwd.h>
5#include <dballe/exporter.h>
6#include <dballe/importer.h>
7#include <dballe/message.h>
8
9#define DBALLE_JSON_VERSION "0.1"
10
11namespace dballe {
12namespace impl {
13namespace msg {
14
15class JsonImporter : public Importer
16{
17public:
18 JsonImporter(const dballe::ImporterOptions& opts =
20 ~JsonImporter();
21
22 Encoding encoding() const override { return Encoding::JSON; }
23
24 bool foreach_decoded(const BinaryMessage& msg,
25 std::function<bool(std::shared_ptr<dballe::Message>)>
26 dest) const override;
27};
28
29class JsonExporter : public Exporter
30{
31public:
32 JsonExporter(const dballe::ExporterOptions& opts =
33 dballe::ExporterOptions::defaults);
34 ~JsonExporter();
35
36 std::string to_binary(const std::vector<std::shared_ptr<dballe::Message>>&
37 msgs) const override;
38};
39
40} // namespace msg
41} // namespace impl
42} // namespace dballe
43#endif
Binary message.
Definition file.h:135
Options to control message export.
Definition exporter.h:25
Options to control message import.
Definition importer.h:25
static const ImporterOptions defaults
Default importer options.
Definition importer.h:52
Encoding encoding() const override
Return the encoding for this importer.
Definition json_codec.h:22