libdballe 9.6
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/importer.h>
6#include <dballe/exporter.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:
20
21 Encoding encoding() const override { return Encoding::JSON; }
22
23 bool foreach_decoded(const BinaryMessage& msg, std::function<bool(std::shared_ptr<dballe::Message>)> dest) const override;
24};
25
26
27class JsonExporter : public Exporter
28{
29public:
30 JsonExporter(const dballe::ExporterOptions& opts=dballe::ExporterOptions::defaults);
32
33 std::string to_binary(const std::vector<std::shared_ptr<dballe::Message>>& msgs) const override;
34};
35
36}
37}
38}
39#endif
Binary message.
Definition: file.h:131
Options to control message export.
Definition: exporter.h:25
Message exporter interface.
Definition: exporter.h:67
Options to control message import.
Definition: importer.h:25
static const ImporterOptions defaults
Default importer options.
Definition: importer.h:54
Message importer interface.
Definition: importer.h:72
Definition: json_codec.h:28
Definition: json_codec.h:16
Encoding encoding() const override
Return the encoding for this importer.
Definition: json_codec.h:21