<commit_before>/**
 * @file
 *
 * @brief Delegate definitions for the `directoryvalue` plugin
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

#ifndef ELEKTRA_CPP_DIRECTORY_VALUE_DELEGATE_HPP
#define ELEKTRA_CPP_DIRECTORY_VALUE_DELEGATE_HPP

#include <kdberrors.h>
#include <kdbplugin.hpp>

#define DIRECTORY_POSTFIX "___dirdata"
#define ARRAY_VALUE_PREFIX "___dirdata:"

namespace elektra
{
using std::pair;
using std::string;

using CppKeySet = kdb::KeySet;

constexpr ssize_t arrayValuePrefixSize = sizeof (ARRAY_VALUE_PREFIX) - 1;

typedef pair<CppKeySet, CppKeySet> KeySetPair;

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

/**
 * @brief Return all array parents of the given key set.
 *
 * @param keys This parameter contains the key set for which this function determines all array parent keys.
 *
 * @return A key set containing all array parents of `keys`
 */
CppKeySet getArrayParents (CppKeySet const & keys);

/**
 * @brief Increase the array index of array elements by one.
 *
 * Since it is also possible that one of the array parents is part of another array, this function also updates the indices of the given
 * array parents.
 *
 * @param parents This parameter contains the array parents for which this function increases the index by one.
 * @param parents This variable stores the arrays elements this function updates.
 *
 * @return A pair containing a copy of `parents` and `arrays`, where all indices specified by `parents` are increased by one
 */
KeySetPair increaseArrayIndices (CppKeySet const & parents, CppKeySet const & arrays);
<commit_msg>Directory Value: Replace `typedef` statement<commit_after>/**
 * @file
 *
 * @brief Delegate definitions for the `directoryvalue` plugin
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

#ifndef ELEKTRA_CPP_DIRECTORY_VALUE_DELEGATE_HPP
#define ELEKTRA_CPP_DIRECTORY_VALUE_DELEGATE_HPP

#include <kdberrors.h>
#include <kdbplugin.hpp>

#define DIRECTORY_POSTFIX "___dirdata"
#define ARRAY_VALUE_PREFIX "___dirdata:"

namespace elektra
{
using std::pair;
using std::string;

using CppKeySet = kdb::KeySet;

constexpr ssize_t arrayValuePrefixSize = sizeof (ARRAY_VALUE_PREFIX) - 1;

using KeySetPair = pair<CppKeySet, CppKeySet>;

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

/**
 * @brief Return all array parents of the given key set.
 *
 * @param keys This parameter contains the key set for which this function determines all array parent keys.
 *
 * @return A key set containing all array parents of `keys`
 */
CppKeySet getArrayParents (CppKeySet const & keys);

/**
 * @brief Increase the array index of array elements by one.
 *
 * Since it is also possible that one of the array parents is part of another array, this function also updates the indices of the given
 * array parents.
 *
 * @param parents This parameter contains the array parents for which this function increases the index by one.
 * @param parents This variable stores the arrays elements this function updates.
 *
 * @return A pair containing a copy of `parents` and `arrays`, where all indices specified by `parents` are increased by one
 */
KeySetPair increaseArrayIndices (CppKeySet const & parents, CppKeySet const & arrays);

{'fraction_non_alphanumeric': 0.14588782330717814, 'fraction_numerical': 0.0005812263876780006, 'mean_word_length': 3.25990099009901, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7656054', 'n_tokens_mistral': 939, 'n_tokens_neox': 931, 'n_words': 374}