<commit_before>/**
 * @file
 *
 * @brief Source for yamlcpp plugin
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

// -- Imports ------------------------------------------------------------------------------------------------------------------------------

#include "yamlcpp.hpp"
#include "yaml.h"

#include <kdb.hpp>
#include <kdbhelper.h>
#include <kdblogger.h>

#include <sstream>
#include <string>

// -- Functions ----------------------------------------------------------------------------------------------------------------------------

static int yamlRead (kdb::KeySet & mappings ELEKTRA_UNUSED, kdb::Key & parent)
{
	using namespace kdb;

	YAML::Node config = YAML::LoadFile (parent.getString ());
	std::ostringstream data;
	data << config;

	ELEKTRA_LOG_DEBUG ("Data: “%s”", data.str ().c_str ());

	return ELEKTRA_PLUGIN_STATUS_NO_UPDATE;
}

extern "C" {
using namespace ckdb;

/**
 * @brief This function returns a key set containing the contract of this plugin.
 *
 * @return A contract describing the functionality of this plugin.
 */
static KeySet * contractYamlCpp (void)
{
	return ksNew (30, keyNew ("system/elektra/modules/yamlcpp", KEY_VALUE, "yamlcpp plugin waits for your orders", KEY_END),<commit_msg>YAML CPP: Remove useless header file<commit_after>/**
 * @file
 *
 * @brief Source for yamlcpp plugin
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

// -- Imports ------------------------------------------------------------------------------------------------------------------------------

#include "yamlcpp.hpp"
#include "yaml.h"

#include <kdb.hpp>
#include <kdblogger.h>

#include <sstream>
#include <string>

// -- Functions ----------------------------------------------------------------------------------------------------------------------------

static int yamlRead (kdb::KeySet & mappings ELEKTRA_UNUSED, kdb::Key & parent)
{
	using namespace kdb;

	YAML::Node config = YAML::LoadFile (parent.getString ());
	std::ostringstream data;
	data << config;

	ELEKTRA_LOG_DEBUG ("Data: “%s”", data.str ().c_str ());

	return ELEKTRA_PLUGIN_STATUS_NO_UPDATE;
}

extern "C" {
using namespace ckdb;

/**
 * @brief This function returns a key set containing the contract of this plugin.
 *
 * @return A contract describing the functionality of this plugin.
 */
static KeySet * contractYamlCpp (void)
{
	return ksNew (30, keyNew ("system/elektra/modules/yamlcpp", KEY_VALUE, "yamlcpp plugin waits for your orders", KEY_END),
{'fraction_non_alphanumeric': 0.30833333333333335, 'fraction_numerical': 0.0015873015873015873, 'mean_word_length': 1.8745724059293045, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6936967', 'n_tokens_mistral': 730, 'n_tokens_neox': 702, 'n_words': 202}