- Fixed some circular includes

- Documentation
 - File Declaration, TODO: Implementation
This commit is contained in:
2025-07-07 21:13:07 -04:00
parent 17d8218124
commit 2573de0904
24 changed files with 445 additions and 154 deletions

View File

@@ -16,9 +16,49 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file assert.h
/// \brief \ref fennec_lang_assert
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_LANG_ASSERT_H
#define FENNEC_LANG_ASSERT_H
///
/// \page fennec_lang_assert Assertions
///
/// \code #include <fennec/lang/assert.h> \endcode
///
/// This header contains macros for making assertions about code behaviour.
///
/// fennec defines the following assert implementations:
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_bits">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// assert(expr, desc)
/// <td width="50%" style="vertical-align: top">
/// Make an assertion with expression `expr` and provide a description `desc`.
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// assertd(expr, desc)
/// <td width="50%" style="vertical-align: top">
/// Make an assertion, ***only in debug mode***, with expression `expr` and provide a description `desc`.
/// This should be used when the branching caused by `assert` would hinder performance in release mode.
///
/// </table>
///
///
///
#if _MSC_VER
#define __PRETTY_FUNCTION__ __FUNCSIG__
#endif

View File

@@ -80,7 +80,7 @@
///
#include <fennec/lang/intrinsics.h>
#include <fennec/memory/memory.h>
#include <fennec/memory/common.h>
#include <fennec/lang/detail/__bits.h>
namespace fennec
@@ -138,9 +138,11 @@ constexpr void* bit_and(void* arr, const void* mask, size_t n)
/// \brief Safe version of fennec::bit_and
///
/// \details Safe version of fennec::bit_and
/// \copydetails fennec::bit_and
/// \param arr the array of bytes to modify
/// \param n0 the size of arr in bytes
/// \param mask the mask to and against arr
/// \param n1 the size of mask in bytes
/// \returns the pointer arr
constexpr void* bit_and_s(void* arr, size_t n0, const void* mask, size_t n1)
{ return bit_and(arr, mask, n0 < n1 ? n0 : n1); }
@@ -175,9 +177,11 @@ constexpr void* bit_or(void* arr, const void* mask, size_t n)
/// \brief Safe version of fennec::bit_or
///
/// \details Safe version of fennec::bit_or
/// \copydetails fennec::bit_or
/// \param arr the array of bytes to modify
/// \param n0 the size of arr in bytes
/// \param mask the mask to or against arr
/// \param n1 the size of mask in bytes
/// \returns the pointer arr
constexpr void* bit_or_s(void* arr, size_t n0, const void* mask, size_t n1)
{ return bit_or(arr, mask, n0 < n1 ? n0 : n1); }
@@ -212,9 +216,11 @@ constexpr void* bit_xor(void* arr, const void* mask, size_t n)
/// \brief Safe version of fennec::bit_xor
///
/// \details Safe version of fennec::bit_xor
/// \copydetails fennec::bit_xor
/// \param arr the array of bytes to modify
/// \param n0 the size of arr in bytes
/// \param mask the mask to or against arr
/// \param n1 the size of mask in bytes
/// \returns the pointer arr
constexpr void* bit_xor_s(void* arr, size_t n0, const void* mask, size_t n1)
{ return bit_xor(arr, mask, n0 < n1 ? n0 : n1); }

View File

@@ -44,8 +44,8 @@
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::conditional "typename conditional<bool_t B, TrueT, FalseT>::type"<br>
/// \ref fennec::conditional_t "conditional_t<bool_t B, TrueT, FalseT>"
/// \ref fennec::conditional "typename conditional<bool B, TrueT, FalseT>::type"<br>
/// \ref fennec::conditional_t "conditional_t<bool B, TrueT, FalseT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::conditional
///
@@ -56,8 +56,8 @@
/// \copydetails fennec::detect
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::enable_if "typename enable_if<bool_t B, TypeT>::type"<br>
/// \ref fennec::enable_if_t "enable_if_t<bool_t B, TypeT>"
/// \ref fennec::enable_if "typename enable_if<bool B, TypeT>::type"<br>
/// \ref fennec::enable_if_t "enable_if_t<bool B, TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::enable_if
/// </table>
@@ -65,7 +65,6 @@
///
#include <fennec/lang/type_transforms.h>
#include <fennec/lang/types.h>
namespace fennec
{
@@ -80,13 +79,13 @@ namespace fennec
/// \tparam B the value of the condition
/// \tparam TrueT type to use when \f$B == true\f$
/// \tparam FalseT type to use when \f$B == false\f$
template<bool_t B, typename TrueT, typename FalseT>
template<bool B, typename TrueT, typename FalseT>
struct conditional;
///
/// \brief Shorthand for ```typename conditional<ConditionV, TrueT, FalseT>::type```
template<bool_t B, typename TrueT, typename FalseT>
template<bool B, typename TrueT, typename FalseT>
using conditional_t
= typename conditional<B, TrueT, FalseT>::type;
@@ -153,12 +152,12 @@ struct detect<DefaultT, DetectT, ArgsT...>
///
/// \tparam B A boolean value
/// \tparam T The type to conditionally define
template<bool_t B, typename T = void>
template<bool B, typename T = void>
struct enable_if {};
///
/// \brief Shorthand for ```typename enable_if<B, T>::type```
template<bool_t B, typename T = void>
template<bool B, typename T = void>
using enable_if_t = typename enable_if<B, T>::type;
// true case

View File

@@ -49,12 +49,12 @@
/// \copydetails fennec::integral_constant
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bool_constant "bool_constant<bool_t ValueV>::type"<br>
/// \ref fennec::bool_constant "bool_constant<bool ValueV>::type"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bool_constant
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::bool_constant "bool_constant<bool_t ValueV>::type"<br>
/// \ref fennec::bool_constant "bool_constant<bool ValueV>::type"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::bool_constant
///
@@ -90,7 +90,7 @@ template<typename IntT, IntT ValueV> struct integral_constant
///
/// \details
/// \tparam ValueV value of the constant
template<bool_t ValueV>
template<bool ValueV>
struct bool_constant
: integral_constant<bool_t, ValueV> {};

View File

@@ -31,9 +31,8 @@
#ifndef FENNEC_LANG_H
#define FENNEC_LANG_H
#include <fennec/lang/assert.h>
#include <fennec/lang/bits.h>
#include <fennec/lang/intrinsics.h>
#include <fennec/lang/limits.h>
#include <fennec/lang/types.h>
#include <fennec/lang/utility.h>
@@ -42,6 +41,7 @@
///
/// This library implements the parts of the C++ stdlib that relate to built-in types and metaprogramming.
///
/// - \subpage fennec_lang_assert
/// - \subpage fennec_lang_bit_manipulation
/// - \subpage fennec_lang_intrinsics
/// - \subpage fennec_lang_limits

View File

@@ -92,10 +92,10 @@
/// \copydetails fennec::is_same
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::can_convert "can_convert<TypeT0, TypeT1>::value"<br>
/// \ref fennec::can_convert_v "can_convert_v<TypeT>"
/// \ref fennec::is_convertible "is_convertible<TypeT0, TypeT1>::value"<br>
/// \ref fennec::is_convertible_v "is_convertible_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::can_convert
/// \copydetails fennec::is_convertible
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_constructible "is_constructible<ClassT, ArgsT...>::value"<br>
@@ -334,8 +334,8 @@ template<typename FromT, typename ToT> struct is_convertible
/// \brief shorthand for `can_convert<TypeT0, TypeT1>::value`
/// \param FromT First type
/// \param ToT Second type
template<typename FromT, typename ToT> using is_convertible_v
= typename is_convertible<FromT, ToT>::type;
template<typename FromT, typename ToT> constexpr bool_t is_convertible_v
= is_convertible<FromT, ToT>{};
// fennec::is_constructible ===============================================================================================

View File

@@ -34,6 +34,8 @@
///
/// \page fennec_lang_types Types
///
/// \code #include <fennec/lang/types.h> \endcode
///
/// \brief This header contains definitions for the built-in types of the C++ language.
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_types">