Commit 22da9c14 authored by Mathieu Giraud's avatar Mathieu Giraud

core/output.{h,cpp}: simple CloneOutput class

See #3358.
Far from perfect, but allows to gather code.
parent 9ce7a54c
#include "output.h"
void CloneOutput::set(string key, json val)
{
j[key] = val ;
}
void CloneOutput::set(string key, string subkey, json val)
{
j[key][subkey] = val ;
}
void CloneOutput::add_warning(string code, string msg, string level)
{
json_add_warning(j, code, msg, level);
}
json CloneOutput::toJson()
{
return j;
}
#ifndef OUTPUT_H
#define OUTPUT_H
#include <string>
#include <fstream>
#include <iostream>
#include "tools.h"
#include "../lib/json.hpp"
#define KEY_SEG "seg"
using namespace std;
using json = nlohmann::json;
class CloneOutput
{
private:
json j;
public:
void set(string key, json val);
void set(string key, string subkey, json val);
void add_warning(string code, string msg, string level);
json toJson();
};
/*
class SampleOutput
{
}
class SampleOutputFormatter
{
}
class SampleOutputFormatterCSV(SampleOutputFormatter)
{
}
class SampleOutputFormatterJson(SampleOutputFormatter)
{
}
*/
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment