<commit_before>#pragma once

#include <string>
#include <vector>
#include <unordered_map>

#include <rapidjson/document.h>
#include <rapidjson/rapidjson.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>

#include "blackhole/record.hpp"

namespace blackhole {

namespace formatter {

namespace json {

struct config_t {
    typedef std::vector<std::string> hierarchy_t;
    typedef std::unordered_map<std::string, std::string> name_mapping_t;
    typedef std::unordered_map<std::string, hierarchy_t> field_hierarchy_t;

    bool newline;
    name_mapping_t name_mapping;
    field_hierarchy_t field_hierarchy;

    config_t() :
        newline(false)
    {}
};

namespace aux {

}

} // namespace json

//! This class looks creppy, because of inconvenient rapidjson interface.
class json_visitor_t : public boost::static_visitor<> {
    rapidjson::Document* root;
    const json::config_t::field_hierarchy_t& field_hierarchy;

    const std::string* name;
public:
    json_visitor_t(rapidjson::Document* root, const json::config_t::field_hierarchy_t& field_hierarchy) :
        root(root),
        field_hierarchy(field_hierarchy),
        name(nullptr)
    {}

    void set_name(const std::string* name) {
        this->name = name;
    }

    template<typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
    void operator ()(T value) const {
        apply(value);
    }

    void operator ()(std::time_t value) const {
        apply(static_cast<int64_t>(value));<commit_msg>Removed empty namespace.<commit_after>#pragma once

#include <string>
#include <vector>
#include <unordered_map>

#include <rapidjson/document.h>
#include <rapidjson/rapidjson.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>

#include "blackhole/record.hpp"

namespace blackhole {

namespace formatter {

namespace json {

struct config_t {
    typedef std::vector<std::string> hierarchy_t;
    typedef std::unordered_map<std::string, std::string> name_mapping_t;
    typedef std::unordered_map<std::string, hierarchy_t> field_hierarchy_t;

    bool newline;
    name_mapping_t name_mapping;
    field_hierarchy_t field_hierarchy;

    config_t() :
        newline(false)
    {}
};

} // namespace json

//! This class looks creppy, because of inconvenient rapidjson interface.
class json_visitor_t : public boost::static_visitor<> {
    rapidjson::Document* root;
    const json::config_t::field_hierarchy_t& field_hierarchy;

    const std::string* name;
public:
    json_visitor_t(rapidjson::Document* root, const json::config_t::field_hierarchy_t& field_hierarchy) :
        root(root),
        field_hierarchy(field_hierarchy),
        name(nullptr)
    {}

    void set_name(const std::string* name) {
        this->name = name;
    }

    template<typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
    void operator ()(T value) const {
        apply(value);
    }

    void operator ()(std::time_t value) const {
        apply(static_cast<int64_t>(value));
{'fraction_non_alphanumeric': 0.11952584787619361, 'fraction_numerical': 0.0013170892327955218, 'mean_word_length': 4.274305555555555, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3846222', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1003, 'n_words': 203}