Spicy
printer-json.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <ostream>
6 #include <utility>
7 
8 #include <hilti/rt/json-fwd.h>
9 #include <hilti/rt/type-info.h>
10 #include <hilti/rt/types/integer.h>
11 
12 #include "options.h"
13 
15 class JSONPrinter {
16 public:
23  JSONPrinter(std::ostream& output, OutputOptions options) : _output(output), _options(options){};
24 
30  void print(const hilti::rt::type_info::Value& v);
31 
32 private:
33  // Return output stream.
34  std::ostream& out() { return _output; }
35 
36  nlohmann::json convert(const hilti::rt::type_info::Value& v);
37 
38  std::ostream& _output;
39  OutputOptions _options;
40 };
void print(const hilti::rt::type_info::Value &v)
Definition: printer-json.cc:16
Definition: options.h:8
JSONPrinter(std::ostream &output, OutputOptions options)
Definition: printer-json.h:23
Definition: type-info.h:82
Definition: printer-json.h:15