<commit_before>/* primitives.tcc                                 -*- C++ -*-
   <NAME> (<EMAIL>), 19 Apr 2014
   FreeBSD-style copyright and disclaimer apply

   Reflection utilities for primitives.
*/

#pragma once

#include "reflect.h"
#include "reflect/basics.h"
#include "reflect/plumbing.h"

#include <limits>

namespace reflect {

/******************************************************************************/
/* REFLECT LIMIT                                                              */
/******************************************************************************/

#define reflectLimit(name) \
    type_->add(#name, [] { return std::numeric_limits<T_>::name(); });


/******************************************************************************/
/* REFLECT NUMBER                                                             */
/******************************************************************************/

template<typename T_>
void reflectNumberImpl(Type* type_)
{
    reflectPlumbing();

    reflectLimit(min);
    reflectLimit(max);

    reflectTrait(primitive);

    if (std::is_same<T_, bool>::value)
        reflectTrait(bool);

    else if (std::numeric_limits<T_>::is_integer) {
        reflectTrait(integer);

        if (std::numeric_limits<T_>::is_signed)
            reflectTrait(signed);
        else reflectTrait(unsigned);
    }

    else reflectTrait(float);
}

#define reflectNumber(num) \
    reflectTypeImpl(num) { reflectNumberImpl<T_>(type_); }

} // reflect<commit_msg>Added operator+ on primitives for the demo.<commit_after>/* primitives.tcc                                 -*- C++ -*-
   <NAME> (<EMAIL>), 19 Apr 2014
   FreeBSD-style copyright and disclaimer apply

   Reflection utilities for primitives.
*/

#pragma once

#include "reflect.h"
#include "reflect/basics.h"
#include "reflect/plumbing.h"

#include <limits>

namespace reflect {

/******************************************************************************/
/* REFLECT LIMIT                                                              */
/******************************************************************************/

#define reflectLimit(name) \
    type_->add(#name, [] { return std::numeric_limits<T_>::name(); });


/******************************************************************************/
/* REFLECT NUMBER                                                             */
/******************************************************************************/

template<typename T_>
void reflectNumberImpl(Type* type_)
{
    reflectPlumbing();

    reflectLimit(min);
    reflectLimit(max);

    reflectTrait(primitive);

    reflectCustom(operator+) (const int& obj, int value) {
        return obj + value;
    };

    if (std::is_same<T_, bool>::value)
        reflectTrait(bool);

    else if (std::numeric_limits<T_>::is_integer) {
        reflectTrait(integer);

        if (std::numeric_limits<T_>::is_signed)
            reflectTrait(signed);
        else reflectTrait(unsigned);
    }

    else reflectTrait(float);
}

#define reflectNumber(num) \
    reflectTypeImpl(num) { reflectNumberImpl<T_>(type_); }

} // reflect
{'fraction_non_alphanumeric': 0.3048586852969197, 'fraction_numerical': 0.003810733566211496, 'mean_word_length': 2.8936959208899875, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7555545', 'n_tokens_mistral': 813, 'n_tokens_neox': 743, 'n_words': 148}