repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
librepr Namespace Reference

Namespaces

namespace   ctti
 
namespace   rtti
 
namespace  category
 
namespace  ctei
 
namespace  ctvi
 
namespace  detail
 
namespace  pack
 

Classes

struct  Accessor
 
struct  Accessor< T C::* >
 
struct  Accessor< T(*)(C const &)>
 
struct  const_string
 
struct  Constant
 
struct  CppVisitor
 
struct  is_literal
 
struct  is_literal< T >
 
struct  is_literal< T[N]>
 
struct  LayoutVisitor
 
struct  Member
 
struct  MemberList
 
struct  Options
 
struct  PythonVisitor
 
struct  Reflect
 
struct  Reflect< char const * >
 
struct  Reflect< T >
 
struct  Reflect< T[]>
 
struct  Reflect< T[N]>
 
class  RefTuple
 
class  RefTuple<>
 
class  ReprVisitor
 
struct  ReprWrapper
 
struct  Settings
 
struct  Tuple
 
struct  TypeList
 
struct  TypeListBase
 
struct  TypeName
 
struct  ValueList
 
struct  ValueListBase
 
struct  Wrap
 

Concepts

concept  has_search_range
 
concept  has_is_flag
 
concept  has_fast_search
 
concept  has_enumerators
 
concept  is_homogeneous_members
 
concept  has_custom_members
 
concept  has_is_literal
 
concept  has_name
 
concept  reflect_names
 
concept  is_variant
 

Typedefs

template<typename T >
using reflect = Reflect< T >
 

Enumerations

enum class  Platform : unsigned {
  Unknown , Linux , UNIX , Windows ,
  macOS
}
 
enum class  Compiler : unsigned { Unknown , Clang , GCC , MSVC }
 
enum class  Language { CPP , Python }
 

Functions

template<typename C , typename T >
 Accessor (T C::*) -> Accessor< T C::* >
 
template<typename C , typename T >
 Accessor (T(*)(C const &)) -> Accessor< T(*)(C const &)>
 
template<typename T , std::size_t N>
 Member (T, char const (&)[N]) -> Member< T, N - 1 >
 
template<typename T , std::size_t N>
 Member (T, const_string< N >) -> Member< T, N >
 
template<typename T >
 Member (T) -> Member< T, 0 >
 
template<typename T >
requires std::is_enum_v<T>
constexpr auto enum_names () noexcept
 
template<typename T >
requires std::is_enum_v<T>
constexpr auto enum_name (T value) noexcept
 
template<auto V>
requires std::is_enum_v<decltype(V)>
constexpr std::string_view enum_name () noexcept
 
std::string demangle (std::string_view mangled)
 
template<typename T >
std::string get_name ()
 
template<typename T >
char constget_mangled_name ()
 
template<typename T >
 Reflect (T &) -> Reflect< T >
 
template<typename T >
requires std::is_enum_v<T>
std::string repr (T const &obj)
 
template<typename T >
std::string repr (T const &obj)
 
std::string repr (bool obj)
 
std::string repr (signed short obj)
 
std::string repr (unsigned short obj)
 
std::string repr (signed int obj)
 
std::string repr (unsigned int obj)
 
std::string repr (signed long obj)
 
std::string repr (unsigned long obj)
 
std::string repr (signed long long obj)
 
std::string repr (unsigned long long obj)
 
std::string repr (float obj)
 
std::string repr (double obj)
 
std::string repr (long double obj)
 
std::string repr (char obj)
 
std::string repr (std::nullptr_t)
 
std::string repr (char const *obj)
 
std::string repr (void const *obj)
 
std::size_t get_terminal_width ()
 
template<typename... Types>
 RefTuple (Types &...) -> RefTuple< Types... >
 
template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) get (RefTuple< Ts... > const &tuple) noexcept
 
template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) get (Tuple< Ts... > const &tuple) noexcept
 
template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) get (Tuple< Ts... > &tuple) noexcept
 
template<std::size_t N>
 const_string (char const (&)[N]) -> const_string< N - 1 >
 
template<typename T >
 Wrap (T) -> Wrap< T >
 
template<typename T , typename V >
void visit (V &&visitor)
 
template<typename T , typename V >
void visit (V &&visitor, T &&obj)
 
template<typename T , Language language = Language::CPP>
std::string code_for ()
 
template<typename T >
std::string layout_of ()
 

Variables

template<typename T >
constexpr bool is_literal_v = is_literal<T>::value
 
constexpr auto compiler = Platform::Unknown
 
template<typename T >
constexpr auto member_names = detail::get_member_names<T>()
 
template<typename T , std::size_t Idx>
constexpr auto member_name = member_names<T>[Idx]
 
template<auto V>
constexpr auto reprof = ctvi::value<V>
 
constexpr auto make_reftuple = detail::make_reftuple_impl{}
 
template<auto V>
constexpr Constant< V > constant {}
 

Typedef Documentation

◆ reflect

Enumeration Type Documentation

◆ Compiler

Enumerator
Unknown 
Clang 
GCC 
MSVC 

◆ Language

Enumerator
CPP 
Python 

◆ Platform

Enumerator
Unknown 
Linux 
UNIX 
Windows 
macOS 

Function Documentation

◆ Accessor() [1/2]

template<typename C , typename T >
librepr::Accessor ( T C::*  ) -> Accessor< T C::* >

◆ Accessor() [2/2]

template<typename C , typename T >
librepr::Accessor ( T(*)(C const &)  ) -> Accessor< T(*)(C const &)>

◆ code_for()

template<typename T , Language language = Language::CPP>
std::string librepr::code_for ( )

Prints code roughly matching the requested type

Template Parameters
TThe type to print
languageWhich language to print the type in
Returns
std::string
Examples
simple.cpp.

◆ const_string()

template<std::size_t N>
librepr::const_string ( char   const(&)[N]) -> const_string< N - 1 >

◆ demangle()

std::string librepr::demangle ( std::string_view  mangled)
inline

◆ enum_name() [1/2]

template<auto V>
requires std::is_enum_v<decltype(V)>
constexpr std::string_view librepr::enum_name ( )
constexprnoexcept

◆ enum_name() [2/2]

template<typename T >
requires std::is_enum_v<T>
constexpr auto librepr::enum_name ( value)
constexprnoexcept

◆ enum_names()

template<typename T >
requires std::is_enum_v<T>
constexpr auto librepr::enum_names ( )
constexprnoexcept

◆ get() [1/3]

template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) librepr::get ( RefTuple< Ts... > const tuple)
constexprnoexcept

◆ get() [2/3]

template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) librepr::get ( Tuple< Ts... > &  tuple)
constexprnoexcept

◆ get() [3/3]

template<std::size_t Idx, typename... Ts>
constexpr decltype(auto) librepr::get ( Tuple< Ts... > const tuple)
constexprnoexcept

◆ get_mangled_name()

template<typename T >
char const * librepr::get_mangled_name ( )

◆ get_name()

template<typename T >
std::string librepr::get_name ( )

◆ get_terminal_width()

std::size_t librepr::get_terminal_width ( )
inline

◆ layout_of()

template<typename T >
std::string librepr::layout_of ( )

◆ Member() [1/3]

template<typename T >
librepr::Member ( ) -> Member< T, 0 >

◆ Member() [2/3]

template<typename T , std::size_t N>
librepr::Member ( ,
char   const(&)[N] 
) -> Member< T, N - 1 >

◆ Member() [3/3]

template<typename T , std::size_t N>
librepr::Member ( ,
const_string< N  
) -> Member< T, N >

◆ Reflect()

template<typename T >
librepr::Reflect ( T &  ) -> Reflect< T >

◆ RefTuple()

template<typename... Types>
librepr::RefTuple ( Types ...) -> RefTuple< Types... >

◆ repr() [1/18]

std::string librepr::repr ( bool  obj)
inline

◆ repr() [2/18]

std::string librepr::repr ( char const obj)
inline

◆ repr() [3/18]

std::string librepr::repr ( char  obj)
inline

◆ repr() [4/18]

std::string librepr::repr ( double  obj)
inline

◆ repr() [5/18]

std::string librepr::repr ( float  obj)
inline

◆ repr() [6/18]

std::string librepr::repr ( long double  obj)
inline

◆ repr() [7/18]

std::string librepr::repr ( signed int  obj)
inline

◆ repr() [8/18]

std::string librepr::repr ( signed long long  obj)
inline

◆ repr() [9/18]

std::string librepr::repr ( signed long  obj)
inline

◆ repr() [10/18]

std::string librepr::repr ( signed short  obj)
inline

◆ repr() [11/18]

std::string librepr::repr ( std::nullptr_t  )
inline

◆ repr() [12/18]

template<typename T >
requires std::is_enum_v<T>
std::string librepr::repr ( T const obj)

◆ repr() [13/18]

template<typename T >
std::string librepr::repr ( T const obj)

◆ repr() [14/18]

std::string librepr::repr ( unsigned int  obj)
inline

◆ repr() [15/18]

std::string librepr::repr ( unsigned long long  obj)
inline

◆ repr() [16/18]

std::string librepr::repr ( unsigned long  obj)
inline

◆ repr() [17/18]

std::string librepr::repr ( unsigned short  obj)
inline

◆ repr() [18/18]

std::string librepr::repr ( void const obj)
inline

◆ visit() [1/2]

template<typename T , typename V >
void librepr::visit ( V &&  visitor)

◆ visit() [2/2]

template<typename T , typename V >
void librepr::visit ( V &&  visitor,
T &&  obj 
)

◆ Wrap()

template<typename T >
librepr::Wrap ( ) -> Wrap< T >

Variable Documentation

◆ compiler

constexpr auto librepr::compiler = Platform::Unknown
inlineconstexpr

◆ constant

template<auto V>
constexpr Constant<V> librepr::constant {}
inlineconstexpr

◆ is_literal_v

template<typename T >
constexpr bool librepr::is_literal_v = is_literal<T>::value
inlineconstexpr

◆ make_reftuple

constexpr auto librepr::make_reftuple = detail::make_reftuple_impl{}
inlineconstexpr

◆ member_name

template<typename T , std::size_t Idx>
constexpr auto librepr::member_name = member_names<T>[Idx]
inlineconstexpr

◆ member_names

template<typename T >
constexpr auto librepr::member_names = detail::get_member_names<T>()
inlineconstexpr

◆ reprof

template<auto V>
constexpr auto librepr::reprof = ctvi::value<V>
inlineconstexpr