View on GitHub

Jules documentation

Documentation of the Jules library

Home Tutorial Modules Entities Files

Header file core/type.hpp

#define JULES_CORE_TYPE_H

namespace jules
{
    using numeric = double;
    
    using string = std::string;
    
    using uinteger = std::uint32_t;
    
    using index_t = std::size_t;
    
    using integer = std::int64_t;
    
    using distance_t = std::ptrdiff_t;
    
    struct numeric_rule;
    
    struct string_rule;
    
    template <typename ... Rules>
    class base_coercion_rules;
    
    using coercion_rules = base_coercion_rules<numeric_rule, string_rule>;
    
    template <typename T, std::size_t N>
    struct recursive_initializer_list;
    
    template <typename T>
    struct recursive_initializer_list<T, 0>;
    
    template <typename T, std::size_t N>
    using recursive_initializer_list_t = typename recursive_initializer_list<T, N>::type;
    
    struct in_place_t;
    
    constexpr in_place_t{} in_place;
    
    template <typename T>
    struct numeric_traits;
}

Type alias jules::numeric [Basic Types]

using numeric = double;

Standard numeric type.

Type alias jules::string [Basic Types]

using string = std::string;

Standard string type.

It is the C++ standard std::string.

Type alias jules::uinteger [Basic Types]

using uinteger = std::uint32_t;

Standard unsigned type.

Type alias jules::index_t [Basic Types]

using index_t = std::size_t;

Standard index type.

Type alias jules::integer [Basic Types]

using integer = std::int64_t;

Standard signed type.

Type alias jules::distance_t [Basic Types]

using distance_t = std::ptrdiff_t;

Standard distance type.

Struct jules::numeric_rule [Coercion Rules]

struct numeric_rule
{
    using type = numeric;
    
    static type coerce_from(const string& value);
};

Coercion rules for numeric type.

Struct jules::string_rule [Coercion Rules]

struct string_rule
{
    using type = string;
    
    static type coerce_from(const numeric& value);
};

Coercion rules for string type.

Class template jules::base_coercion_rules [Coercion Rules]

template <typename ... Rules>
class base_coercion_rules
{
public:
    template <std::size_t I>
    using type = typename std::tuple_element<I, types>::type;
    
    static constexpr auto type_count();
    
    template <std::size_t I>
    using rule = typename std::tuple_element<I, rules>::type;
    
    static constexpr auto rule_count();
};

Utility class to combine coercion rules.

Alias template jules::base_coercion_rules::type

template <std::size_t I>
using type = typename std::tuple_element<I, types>::type;

Access the I-th type.

Function jules::base_coercion_rules::type_count

static constexpr auto type_count();

Retrieves the number of types.

Alias template jules::base_coercion_rules::rule

template <std::size_t I>
using rule = typename std::tuple_element<I, rules>::type;

Access the I-th rule.

Function jules::base_coercion_rules::rule_count

static constexpr auto rule_count();

Retrieves the number of rules.


Type alias jules::coercion_rules [Coercion Rules]

using coercion_rules = base_coercion_rules<numeric_rule, string_rule>;

Default class with coercion rules for numeric and string classes.