Mirror reflection library 0.5.13
|
00001 00010 #ifndef MIRROR_META_CLASS_1011291729_HPP 00011 #define MIRROR_META_CLASS_1011291729_HPP 00012 00013 #include <mirror/meta_namespace.hpp> 00014 #include <mirror/meta_type.hpp> 00015 #include <mirror/meta_typedef.hpp> 00016 #include <mirror/specifier_tags.hpp> 00017 #include <mirror/constructor_tags.hpp> 00018 #include <mirror/auxiliary/default_spec_tags.hpp> 00019 #include <mirror/auxiliary/class_layout.hpp> 00020 #include <mirror/auxiliary/base_classes.hpp> 00021 #include <mirror/auxiliary/member_variables.hpp> 00022 #include <mirror/auxiliary/constructors.hpp> 00023 #include <mirror/auxiliary/member_functions.hpp> 00024 #include <mirror/meta_prog/identity.hpp> 00025 #include <mirror/meta_prog/lambda.hpp> 00026 #include <mirror/meta_prog/range.hpp> 00027 #include <mirror/meta_prog/concat.hpp> 00028 #include <mirror/meta_prog/unique.hpp> 00029 #include <mirror/meta_prog/fold.hpp> 00030 #include <mirror/meta_prog/apply_on_seq_pack.hpp> 00031 #include <initializer_list> 00032 #include <type_traits> 00033 00034 MIRROR_NAMESPACE_BEGIN 00035 namespace _class { 00036 00037 // Helper structure for storing information about class inheritance 00038 template < 00039 typename InheritanceType, 00040 typename AccessSpecifier, 00041 typename BaseClass 00042 > 00043 struct inheritance 00044 { 00045 typedef InheritanceType inherit; 00046 typedef AccessSpecifier access; 00047 typedef BaseClass base; 00048 }; 00049 00050 // helper structure for storing information about member variable 00051 template < 00052 typename AccessType, 00053 typename StorageClass, 00054 typename TypeSelector 00055 > 00056 struct member 00057 { 00058 typedef AccessType access_type; 00059 typedef StorageClass storage_class; 00060 typedef TypeSelector type_sel; 00061 typedef TypeSelector real_type; 00062 }; 00063 00064 // specialization of member for members with typedefined typs 00065 template < 00066 typename AccessType, 00067 typename StorageClass, 00068 typename BaseTypedef 00069 > 00070 struct member< 00071 AccessType, 00072 StorageClass, 00073 mirror::_typedef::_selector<BaseTypedef> 00074 > 00075 { 00076 typedef AccessType access_type; 00077 typedef StorageClass storage_class; 00078 typedef mirror::_typedef::_selector<BaseTypedef> 00079 type_sel; 00080 typedef typename BaseTypedef::source_type real_type; 00081 }; 00082 00083 struct _defs_base 00084 { 00085 typedef mirror::mp::range<> base_classes; 00086 typedef std::integral_constant<int, 0> attr_count; 00087 00088 typedef std::integral_constant<int, 0> ctr_count; 00089 00090 typedef std::integral_constant<int, 0> mem_ovldfn_count; 00091 00092 template <int Idx> 00093 static mirror::custom_constructor_tag 00094 ctr_kind(std::integral_constant<int, Idx>); 00095 00096 typedef mp::range<> conv_ops; 00097 }; 00098 00099 template <typename Class, typename TypeKind> 00100 struct _defaults 00101 : _defs_base 00102 , mirror::_type::_<Class> 00103 { 00104 typedef Class _this; 00105 typedef TypeKind kind; 00106 typedef meta_class_tag category; 00107 // 00108 typedef typename ::std::has_trivial_default_constructor< 00109 Class 00110 >::type has_default_ctr; 00111 00112 typedef typename ::std::has_trivial_copy_constructor< 00113 Class 00114 >::type has_copy_ctr; 00115 }; 00116 00117 template <typename Class, typename TypeKind> 00118 struct _defaults_native : _defs_base 00119 { 00120 typedef Class _this; 00121 typedef TypeKind kind; 00122 00123 typedef std::true_type has_default_ctr; 00124 typedef std::true_type has_copy_ctr; 00125 00126 // default constructor 00127 struct ctr_params_default 00128 { 00129 typedef std::integral_constant<int, 0> size; 00130 }; 00131 static ctr_params_default ctr_params(std::integral_constant<int, 0>); 00132 static spec_public_tag ctr_access(std::integral_constant<int, 0>); 00133 00134 // copy-constructor / initializer 00135 struct ctr_params_copy 00136 { 00137 typedef std::integral_constant<int, 0> param_idx_source; 00138 static mp::identity<_this> type(param_idx_source); 00139 static const char* name( param_idx_source ) 00140 { 00141 return "source"; 00142 } 00143 static size_t name_length( param_idx_source ) 00144 { 00145 return sizeof("source") - 1; 00146 } 00147 static typename mirror::cts::string< 00148 's', 'o', 'u', 'r', 'c', 'e' 00149 >::type ct_name( param_idx_source ); 00150 typedef std::integral_constant<int, 1> size; 00151 }; 00152 static ctr_params_copy ctr_params(std::integral_constant<int, 1>); 00153 static spec_public_tag ctr_access(std::integral_constant<int, 1>); 00154 00155 typedef std::integral_constant<int, 2> ctr_count; 00156 }; 00157 00158 template <typename Class> 00159 struct _defaults<Class, mirror::spec_enum_tag> 00160 : public _defaults_native<Class, mirror::spec_enum_tag> 00161 { 00162 // TODO: conversion of enum values to ints 00163 typedef mp::range<> conv_ops; 00164 }; 00165 00166 // Default implementation of the _ template providing base info 00167 template <typename Class> 00168 struct _ : _defaults<Class, typename mirror::_type::_<Class>::kind> 00169 { }; 00170 00171 } // namespace _class 00172 00173 #ifdef MIRROR_DOCUMENTATION_ONLY 00174 00175 00185 #define MIRROR_REG_GLOBAL_SCOPE_CLASS_BEGIN(ELABORATED_TYPE, CLASS) 00186 #else 00187 #define MIRROR_REG_GLOBAL_SCOPE_CLASS_BEGIN(ELABORATED_TYPE, CLASS) \ 00188 MIRROR_REG_GLOBAL_SCOPE_TYPE_BASICS(ELABORATED_TYPE, CLASS, ()) \ 00189 MIRROR_ADD_TO_GLOBAL_LIST( \ 00190 mirror::_namespace :: _, \ 00191 mirror::meta_class< CLASS > \ 00192 ) \ 00193 namespace _class { \ 00194 template <> \ 00195 struct _< CLASS > \ 00196 : _defaults< CLASS, spec_ ## ELABORATED_TYPE ## _tag >\ 00197 { 00198 #endif 00199 00200 #ifdef MIRROR_DOCUMENTATION_ONLY 00201 00202 00213 #define MIRROR_REG_CLASS_BEGIN(ELABORATED_TYPE, NAMESPACE, CLASS) 00214 #else 00215 #define MIRROR_REG_CLASS_BEGIN(ELABORATED_TYPE, NAMESPACE, CLASS) \ 00216 MIRROR_REG_TYPE_BASICS(class, NAMESPACE, CLASS, ()) \ 00217 MIRROR_ADD_TO_GLOBAL_LIST( \ 00218 mirror::_namespace :: NAMESPACE :: _, \ 00219 mirror::meta_class< :: NAMESPACE :: CLASS> \ 00220 ) \ 00221 namespace _class { \ 00222 template <> \ 00223 struct _< :: NAMESPACE :: CLASS > \ 00224 : _defaults< :: NAMESPACE :: CLASS, spec_ ## ELABORATED_TYPE ## _tag >\ 00225 { 00226 #endif 00227 00228 #ifdef MIRROR_DOCUMENTATION_ONLY 00229 00230 00242 #define MIRROR_REG_NESTED_CLASS_BEGIN(ELABORATED_TYPE, PARENT_CLASS, CLASS) 00243 #else 00244 #define MIRROR_REG_NESTED_CLASS_BEGIN(ELABORATED_TYPE, PARENT_CLASS, CLASS) \ 00245 MIRROR_REG_NESTED_TYPE_BASICS(class, PARENT_CLASS, CLASS, ()) \ 00246 namespace _class { \ 00247 template <> \ 00248 struct _< :: PARENT_CLASS :: CLASS > \ 00249 : _defaults< :: PARENT_CLASS :: CLASS, spec_ ## ELABORATED_TYPE ## _tag >\ 00250 { \ 00251 typedef spec_ ## ELABORATED_TYPE ## _tag kind; 00252 #endif 00253 00254 #ifdef MIRROR_DOCUMENTATION_ONLY 00255 00256 00262 #define MIRROR_REG_CLASS_END 00263 #else 00264 #define MIRROR_REG_CLASS_END \ 00265 }; /* struct _class::_< :: NAMESPACE :: CLASS > */ \ 00266 } /* namespace _class */ 00267 #endif 00268 00269 #ifdef MIRROR_DOCUMENTATION_ONLY 00270 00271 00281 #define MIRROR_REG_TYPE_ALIAS(TYPENAME, ALIAS) 00282 #else 00283 #define MIRROR_REG_TYPE_ALIAS(TYPENAME, ALIAS) \ 00284 typedef MIRROR_PP_EXPAND_ARGS TYPENAME ALIAS; 00285 #endif 00286 00287 #ifdef MIRROR_DOCUMENTATION_ONLY 00288 00289 00298 #define MIRROR_REG_BASE_CLASSES_BEGIN 00299 #else 00300 #define MIRROR_REG_BASE_CLASSES_BEGIN \ 00301 typedef mirror::mp::range< 00302 #endif 00303 00304 #ifdef MIRROR_DOCUMENTATION_ONLY 00305 00306 00316 #define MIRROR_REG_BASE_CLASSES_END 00317 #else 00318 #define MIRROR_REG_BASE_CLASSES_END \ 00319 > base_classes; 00320 #endif 00321 00322 00323 #ifdef MIRROR_DOCUMENTATION_ONLY 00324 00325 00348 #define MIRROR_REG_BASE_CLASS(INHERITANCE_TYPE, ACCESS_TYPE, BASE_CLASS) 00349 #else 00350 #define MIRROR_REG_BASE_CLASS(INHERITANCE_TYPE, ACCESS_TYPE, BASE_CLASS)\ 00351 mirror::_class::inheritance< \ 00352 spec_ ## INHERITANCE_TYPE ## _tag, \ 00353 spec_ ## ACCESS_TYPE ## _tag, \ 00354 BASE_CLASS \ 00355 > 00356 #endif 00357 00358 #ifdef MIRROR_DOCUMENTATION_ONLY 00359 00360 00370 #define MIRROR_REG_CLASS_MEM_VARS_BEGIN 00371 #else 00372 #define MIRROR_REG_CLASS_MEM_VARS_BEGIN \ 00373 template <typename T, typename P> static T attr_type(T*, P); \ 00374 template <typename T> static T attr_type(_*, T _this::*); \ 00375 template <typename T> static T attr_type(_*, T*); \ 00376 template <typename T> static T real_attr_type(T*); \ 00377 template <typename BTD> static typename BTD::source_type \ 00378 real_attr_type(mirror::_typedef::_selector<BTD>*); \ 00379 static spec___tag member_access(std::integral_constant<int, -1>); \ 00380 typedef std::integral_constant<int, 0> 00381 #endif 00382 00383 #ifdef MIRROR_DOCUMENTATION_ONLY 00384 00385 00395 #define MIRROR_REG_CLASS_MEM_VARS_END 00396 #else 00397 #define MIRROR_REG_CLASS_MEM_VARS_END \ 00398 attr_count; 00399 #endif 00400 00401 #define MIRROR_REG_CLASS_MEM_VAR_BEGIN_CTS( \ 00402 ACCESS_TYPE, \ 00403 STORAGE_CLASS, \ 00404 TYPE, \ 00405 NAME, \ 00406 SPELLED, \ 00407 MEM_PTR \ 00408 ) \ 00409 attr_idx_ ## NAME; \ 00410 typedef decltype(attr_type((TYPE*)nullptr, MEM_PTR)) \ 00411 attr_type_ ## NAME; \ 00412 typedef decltype(real_attr_type((attr_type_ ## NAME*)nullptr)) \ 00413 real_attr_type_ ## NAME; \ 00414 static typename mirror::aux::resof_member_access< \ 00415 _, \ 00416 spec_ ## ACCESS_TYPE ## _tag, \ 00417 attr_idx_ ## NAME ::value \ 00418 >::type member_access(attr_idx_ ## NAME); \ 00419 typedef member< \ 00420 decltype(member_access(attr_idx_ ## NAME())), \ 00421 spec_ ## STORAGE_CLASS ## _tag, \ 00422 attr_type_ ## NAME \ 00423 > mem_var_ ## NAME; \ 00424 static mem_var_ ## NAME attr_traits(attr_idx_ ## NAME); \ 00425 static const char* attr_name( attr_idx_ ## NAME ) \ 00426 { \ 00427 return #NAME; \ 00428 } \ 00429 static size_t attr_name_length( attr_idx_ ## NAME ) \ 00430 { \ 00431 return sizeof(#NAME) - 1; \ 00432 } \ 00433 static typename mirror::cts::string< \ 00434 MIRROR_PP_EXPAND_ARGS SPELLED \ 00435 >::type attr_ct_name( attr_idx_ ## NAME ); \ 00436 template <typename X> \ 00437 struct by_name_typ_ ## NAME \ 00438 { \ 00439 typedef X NAME; \ 00440 }; \ 00441 template <typename X> \ 00442 static by_name_typ_ ## NAME <X> by_name_typ(attr_idx_ ## NAME, X*); \ 00443 template <typename X> \ 00444 struct by_name_val_ ## NAME \ 00445 { \ 00446 X NAME; \ 00447 by_name_val_ ## NAME(void) = default; \ 00448 template <class Parent, typename Param> \ 00449 by_name_val_ ## NAME(Parent& parent, Param param) \ 00450 : NAME(parent, param) \ 00451 { } \ 00452 }; \ 00453 template <typename X> \ 00454 static by_name_val_ ## NAME <X> by_name_val(attr_idx_ ## NAME, X*); \ 00455 typedef typename mem_var_ ## NAME :: real_type real_type_ ## NAME; \ 00456 typedef const real_type_ ## NAME & r_value_ ## NAME; 00457 00458 #define MIRROR_REG_CLASS_MEM_VAR_END( \ 00459 NAME \ 00460 ) typedef std::integral_constant<int, attr_idx_ ## NAME::value + 1> 00461 00462 00463 #define MIRROR_REG_CLASS_MEM_VAR_GET_SET_HLPR( \ 00464 NAME, \ 00465 GET_EXPRESSION, \ 00466 SET_EXPRESSION \ 00467 ) \ 00468 static auto get( \ 00469 attr_idx_ ## NAME, \ 00470 const _this& _ \ 00471 ) -> decltype(GET_EXPRESSION) { return GET_EXPRESSION ;} \ 00472 static void set( \ 00473 attr_idx_ ## NAME, \ 00474 _this& _, \ 00475 r_value_ ## NAME _ ## NAME \ 00476 ) { SET_EXPRESSION ; } 00477 00478 #define MIRROR_REG_CLASS_MEM_VAR_GET_SET_CTS( \ 00479 ACCESS_TYPE, \ 00480 STORAGE_CLASS, \ 00481 TYPE, \ 00482 NAME, \ 00483 SPELLED, \ 00484 GET_EXPRESSION, \ 00485 SET_EXPRESSION \ 00486 ) \ 00487 MIRROR_REG_CLASS_MEM_VAR_BEGIN_CTS( \ 00488 ACCESS_TYPE, \ 00489 STORAGE_CLASS, \ 00490 TYPE, \ 00491 NAME, \ 00492 SPELLED, \ 00493 (TYPE*)nullptr \ 00494 ) \ 00495 MIRROR_REG_CLASS_MEM_VAR_GET_SET_HLPR( \ 00496 NAME, \ 00497 GET_EXPRESSION, \ 00498 SET_EXPRESSION \ 00499 ) \ 00500 static std::false_type has_address(attr_idx_ ## NAME); \ 00501 static void* address( attr_idx_ ## NAME, const _this& _ ); \ 00502 static void* mem_ptr(attr_idx_ ## NAME); \ 00503 MIRROR_REG_CLASS_MEM_VAR_END(NAME) 00504 00505 #ifdef MIRROR_DOCUMENTATION_ONLY 00506 00507 00550 #define MIRROR_REG_CLASS_MEM_VAR_GET_SET( \ 00551 ACCESS_TYPE, \ 00552 STORAGE_CLASS, \ 00553 TYPE, \ 00554 NAME, \ 00555 GET_EXPRESSION, \ 00556 SET_EXPRESSION \ 00557 ) 00558 #else 00559 #define MIRROR_REG_CLASS_MEM_VAR_GET_SET( \ 00560 ACCESS_TYPE, \ 00561 STORAGE_CLASS, \ 00562 TYPE, \ 00563 NAME, \ 00564 GET_EXPRESSION, \ 00565 SET_EXPRESSION \ 00566 ) MIRROR_REG_CLASS_MEM_VAR_GET_SET_CTS( \ 00567 ACCESS_TYPE, \ 00568 STORAGE_CLASS, \ 00569 TYPE, \ 00570 NAME, (), \ 00571 GET_EXPRESSION, \ 00572 SET_EXPRESSION \ 00573 ) 00574 #endif 00575 00576 #define MIRROR_REG_CLASS_MEM_VAR_CTS( \ 00577 ACCESS_TYPE, \ 00578 STORAGE_CLASS, \ 00579 TYPE, \ 00580 NAME, \ 00581 SPELLED \ 00582 ) MIRROR_REG_CLASS_MEM_VAR_BEGIN_CTS( \ 00583 ACCESS_TYPE, \ 00584 STORAGE_CLASS, \ 00585 TYPE, \ 00586 NAME, \ 00587 SPELLED, \ 00588 &_this::NAME \ 00589 ) \ 00590 static const real_attr_type_ ## NAME& get( \ 00591 attr_idx_ ## NAME, \ 00592 const _this& _ \ 00593 ){ return _.NAME; } \ 00594 static void set( \ 00595 attr_idx_ ## NAME, \ 00596 _this& _, \ 00597 r_value_ ## NAME _ ## NAME \ 00598 ) { _.NAME = _ ## NAME; } \ 00599 static std::true_type has_address(attr_idx_ ## NAME); \ 00600 static auto address( attr_idx_ ## NAME, _this& _ ) \ 00601 -> decltype(&_.NAME) { return &_.NAME; } \ 00602 static auto address( attr_idx_ ## NAME, const _this& _ ) \ 00603 -> decltype(&_.NAME) { return &_.NAME; } \ 00604 static auto mem_ptr(attr_idx_ ## NAME) \ 00605 -> decltype(&_this::NAME) { return &_this::NAME; } \ 00606 MIRROR_REG_CLASS_MEM_VAR_END(NAME) 00607 00608 #ifdef MIRROR_DOCUMENTATION_ONLY 00609 00610 00639 #define MIRROR_REG_CLASS_MEM_VAR( \ 00640 ACCESS_TYPE, \ 00641 STORAGE_CLASS, \ 00642 TYPE, \ 00643 NAME \ 00644 ) 00645 #else 00646 #define MIRROR_REG_CLASS_MEM_VAR( \ 00647 ACCESS_TYPE, \ 00648 STORAGE_CLASS, \ 00649 TYPE, \ 00650 NAME \ 00651 ) MIRROR_REG_CLASS_MEM_VAR_CTS( \ 00652 ACCESS_TYPE, \ 00653 STORAGE_CLASS, \ 00654 TYPE, \ 00655 NAME, () \ 00656 ) 00657 #endif 00658 00659 #ifdef MIRROR_DOCUMENTATION_ONLY 00660 00661 00674 #define MIRROR_REG_CONSTRUCTORS_BEGIN 00675 #else 00676 #define MIRROR_REG_CONSTRUCTORS_BEGIN \ 00677 typedef std::integral_constant<int, 0> 00678 #endif 00679 00680 #ifdef MIRROR_DOCUMENTATION_ONLY 00681 00682 00695 #define MIRROR_REG_CONSTRUCTORS_END 00696 #else 00697 #define MIRROR_REG_CONSTRUCTORS_END \ 00698 ctr_count; 00699 #endif 00700 00701 #ifdef MIRROR_DOCUMENTATION_ONLY 00702 00703 00718 #define MIRROR_REG_DEFAULT_CONSTRUCTOR(ACCESS_TYPE) 00719 #else 00720 #define MIRROR_REG_DEFAULT_CONSTRUCTOR(ACCESS_TYPE) \ 00721 ctr_index_default; \ 00722 typedef std::true_type has_default_ctr; \ 00723 struct ctr_params_default \ 00724 { \ 00725 typedef std::integral_constant<int, 0> size; \ 00726 };\ 00727 static ctr_params_default ctr_params(ctr_index_default); \ 00728 static spec_ ## ACCESS_TYPE ## _tag ctr_access(ctr_index_default); \ 00729 static default_constructor_tag ctr_kind(ctr_index_default); \ 00730 typedef std::integral_constant<int, ctr_index_default::value + 1> 00731 #endif 00732 00733 #ifdef MIRROR_DOCUMENTATION_ONLY 00734 00735 00750 #define MIRROR_REG_COPY_CONSTRUCTOR(ACCESS_TYPE) 00751 #else 00752 #define MIRROR_REG_COPY_CONSTRUCTOR(ACCESS_TYPE) \ 00753 ctr_index_copy; \ 00754 typedef std::true_type has_copy_ctr; \ 00755 struct ctr_params_copy \ 00756 { \ 00757 typedef std::integral_constant<int, 0> param_idx_source; \ 00758 static mp::identity<_this> type(param_idx_source); \ 00759 static const char* name( param_idx_source ) \ 00760 { \ 00761 return "source"; \ 00762 } \ 00763 static size_t name_length( param_idx_source ) \ 00764 { \ 00765 return sizeof("source") - 1; \ 00766 } \ 00767 static typename mirror::cts::string< \ 00768 's', 'o', 'u', 'r', 'c', 'e' \ 00769 >::type ct_name( param_idx_source ); \ 00770 typedef std::integral_constant<int, 1> size; \ 00771 }; \ 00772 static ctr_params_copy ctr_params(ctr_index_copy); \ 00773 static spec_ ## ACCESS_TYPE ## _tag ctr_access(ctr_index_copy); \ 00774 static copy_constructor_tag ctr_kind(ctr_index_copy); \ 00775 typedef std::integral_constant<int, ctr_index_copy::value + 1> 00776 #endif 00777 00778 #define MIRROR_REG_INITLIST_CONSTRUCTOR_CTS( \ 00779 ACCESS_TYPE, \ 00780 ELEMENT_TYPE, \ 00781 NAME, \ 00782 SPELLED \ 00783 ) \ 00784 ctr_index_initlist; \ 00785 typedef std::true_type has_initlist_ctr; \ 00786 struct ctr_params_initlist \ 00787 { \ 00788 typedef std::integral_constant<int, 0> param_idx_source; \ 00789 static mp::identity<std::initializer_list< ELEMENT_TYPE > > \ 00790 type(param_idx_source); \ 00791 static const char* name( param_idx_source ) \ 00792 { \ 00793 return #NAME; \ 00794 } \ 00795 static size_t name_length( param_idx_source ) \ 00796 { \ 00797 return sizeof(#NAME) - 1; \ 00798 } \ 00799 static typename mirror::cts::string< \ 00800 MIRROR_PP_EXPAND_ARGS SPELLED \ 00801 >::type ct_name( param_idx_source ); \ 00802 typedef std::integral_constant<int, 1> size; \ 00803 }; \ 00804 static ctr_params_initlist ctr_params(ctr_index_initlist); \ 00805 static spec_ ## ACCESS_TYPE ## _tag ctr_access(ctr_index_initlist); \ 00806 static initializer_list_constructor_tag ctr_kind(ctr_index_initlist);\ 00807 typedef std::integral_constant<int, ctr_index_initlist::value + 1> 00808 00809 #ifdef MIRROR_DOCUMENTATION_ONLY 00810 00811 00830 #define MIRROR_REG_INITLIST_CONSTRUCTOR(ACCESS_TYPE, ELEMENT_TYPE, NAME) 00831 #else 00832 #define MIRROR_REG_INITLIST_CONSTRUCTOR(ACCESS_TYPE, ELEMENT_TYPE, NAME) \ 00833 MIRROR_REG_INITLIST_CONSTRUCTOR_CTS( \ 00834 ACCESS_TYPE, \ 00835 ELEMENT_TYPE, \ 00836 NAME, () \ 00837 ) 00838 #endif 00839 00840 #ifdef MIRROR_DOCUMENTATION_ONLY 00841 00842 00853 #define MIRROR_REG_STRUCT_INITIALIZER() 00854 #else 00855 #define MIRROR_REG_STRUCT_INITIALIZER() \ 00856 ctr_index_structinit; \ 00857 struct ctr_params_structinit \ 00858 { \ 00859 typedef attr_count size; \ 00860 template <typename AttrTraits> \ 00861 static auto type_hlpr(AttrTraits)-> \ 00862 typename AttrTraits::real_type; \ 00863 template <int Idx> \ 00864 static auto type(std::integral_constant<int, Idx> idx) -> \ 00865 mp::identity<decltype(type_hlpr(attr_traits(idx)))>; \ 00866 template <int Idx> \ 00867 static const char* name(std::integral_constant<int, Idx> idx) \ 00868 { \ 00869 return attr_name(idx); \ 00870 } \ 00871 template <int Idx> \ 00872 static size_t name_length(std::integral_constant<int, Idx> idx)\ 00873 { \ 00874 return attr_name_length(idx); \ 00875 } \ 00876 template <int Idx> \ 00877 static auto ct_name(std::integral_constant<int, Idx> idx) -> \ 00878 decltype(attr_ct_name(idx)); \ 00879 }; \ 00880 static ctr_params_structinit ctr_params(ctr_index_structinit); \ 00881 static spec_public_tag ctr_access(ctr_index_structinit); \ 00882 static std::true_type is_strinit(ctr_index_structinit); \ 00883 static struct_initializer_tag ctr_kind(ctr_index_structinit); \ 00884 typedef std::integral_constant<int, ctr_index_structinit::value + 1> 00885 #endif 00886 00887 00888 #define MIRROR_REG_MEM_FUNCTION_PARAM_CTS(TYPE, NAME, SPELLED) \ 00889 param_idx_ ## NAME; \ 00890 template <typename _That> \ 00891 struct atr_typ_hlp_ ## NAME \ 00892 { \ 00893 typedef decltype(attr_type((TYPE*)nullptr, &_That::NAME))\ 00894 type; \ 00895 }; \ 00896 template <typename _Type> \ 00897 static mirror::mp::identity<_Type> \ 00898 get_type(_Type*, param_idx_ ## NAME); \ 00899 static atr_typ_hlp_ ## NAME <_this> \ 00900 get_type(_*, param_idx_ ## NAME);\ 00901 static auto type(param_idx_ ## NAME pi) -> \ 00902 decltype(get_type((TYPE*)nullptr, pi)); \ 00903 static const char* name( param_idx_ ## NAME) \ 00904 { \ 00905 return #NAME; \ 00906 } \ 00907 static size_t name_length( param_idx_ ## NAME) \ 00908 { \ 00909 return sizeof(#NAME) - 1; \ 00910 } \ 00911 static typename mirror::cts::string< \ 00912 MIRROR_PP_EXPAND_ARGS SPELLED \ 00913 >::type ct_name(param_idx_ ## NAME); \ 00914 typedef std::integral_constant<int, param_idx_ ## NAME ::value + 1> 00915 00916 #ifdef MIRROR_DOCUMENTATION_ONLY 00917 00918 00942 #define MIRROR_REG_CONSTRUCTOR_BEGIN(ACCESS_TYPE, ID) 00943 #else 00944 #define MIRROR_REG_CONSTRUCTOR_BEGIN(ACCESS_TYPE, ID) \ 00945 ctr_index_ ## ID; \ 00946 static spec_ ## ACCESS_TYPE ## _tag ctr_access(ctr_index_ ## ID); \ 00947 struct ctr_params_ ## ID \ 00948 { \ 00949 typedef std::integral_constant<int, 0> 00950 #endif 00951 00952 #ifdef MIRROR_DOCUMENTATION_ONLY 00953 00954 00970 #define MIRROR_REG_CONSTRUCTOR_END(ID) 00971 #else 00972 #define MIRROR_REG_CONSTRUCTOR_END(ID) \ 00973 size; \ 00974 }; \ 00975 static ctr_params_ ## ID ctr_params(ctr_index_ ## ID); \ 00976 static custom_constructor_tag ctr_kind(ctr_index_ ## ID); \ 00977 typedef std::integral_constant<int, ctr_index_ ## ID ::value + 1> 00978 #endif 00979 00980 #ifdef MIRROR_DOCUMENTATION_ONLY 00981 00982 00983 01001 #define MIRROR_REG_MEM_FUNCTION_PARAM(TYPE, NAME) 01002 #else 01003 #define MIRROR_REG_MEM_FUNCTION_PARAM(TYPE, NAME) \ 01004 MIRROR_REG_MEM_FUNCTION_PARAM_CTS(TYPE, NAME, ()) 01005 #endif 01006 01007 #define MIRROR_REG_CONSTRUCTOR_PARAM_CTS(TYPE, NAME, SPELLED) \ 01008 MIRROR_REG_MEM_FUNCTION_PARAM_CTS(TYPE, NAME, SPELLED) 01009 01010 #ifdef MIRROR_DOCUMENTATION_ONLY 01011 01012 01031 #define MIRROR_REG_CONSTRUCTOR_PARAM(TYPE, NAME) 01032 #else 01033 #define MIRROR_REG_CONSTRUCTOR_PARAM(TYPE, NAME) \ 01034 MIRROR_REG_MEM_FUNCTION_PARAM(TYPE, NAME) 01035 #endif 01036 01037 #ifdef MIRROR_DOCUMENTATION_ONLY 01038 01039 01048 #define MIRROR_REG_MEM_FUNCTIONS_BEGIN 01049 #else 01050 #define MIRROR_REG_MEM_FUNCTIONS_BEGIN \ 01051 typedef std::integral_constant<int, 0> 01052 #endif 01053 01054 #ifdef MIRROR_DOCUMENTATION_ONLY 01055 01056 01065 #define MIRROR_REG_MEM_FUNCTIONS_END 01066 #else 01067 #define MIRROR_REG_MEM_FUNCTIONS_END \ 01068 mem_ovldfn_count; 01069 #endif 01070 01071 #define MIRROR_REG_MEM_OVLD_FUNC_BEGIN_CTS(NAME, SPELLED) \ 01072 mem_ovldfn_idx_ ## NAME ; \ 01073 static const char* memfn_name( mem_ovldfn_idx_ ## NAME) \ 01074 { \ 01075 return #NAME; \ 01076 } \ 01077 static size_t memfn_name_length( mem_ovldfn_idx_ ## NAME) \ 01078 { \ 01079 return sizeof(#NAME) - 1; \ 01080 } \ 01081 static typename mirror::cts::string< \ 01082 MIRROR_PP_EXPAND_ARGS SPELLED \ 01083 >::type memfn_ct_name( mem_ovldfn_idx_ ## NAME); \ 01084 struct mem_ovldfn_ ## NAME { \ 01085 typedef std::integral_constant<int, 0> 01086 01087 01088 #ifdef MIRROR_DOCUMENTATION_ONLY 01089 01090 01102 #define MIRROR_REG_MEM_OVLD_FUNC_BEGIN(NAME) 01103 #else 01104 #define MIRROR_REG_MEM_OVLD_FUNC_BEGIN(NAME) \ 01105 MIRROR_REG_MEM_OVLD_FUNC_BEGIN_CTS(NAME, ()) 01106 #endif 01107 01108 01109 #ifdef MIRROR_DOCUMENTATION_ONLY 01110 01111 01123 #define MIRROR_REG_MEM_OVLD_FUNC_END(NAME) 01124 #else 01125 #define MIRROR_REG_MEM_OVLD_FUNC_END(NAME) \ 01126 memfn_count; \ 01127 }; \ 01128 static mem_ovldfn_ ## NAME mem_ovldfn( mem_ovldfn_idx_ ## NAME ); \ 01129 typedef std::integral_constant<int, mem_ovldfn_idx_ ## NAME ::value + 1> 01130 #endif 01131 01132 01133 #ifdef MIRROR_DOCUMENTATION_ONLY 01134 01135 01163 #define MIRROR_REG_MEM_FUNCTION_BEGIN( \ 01164 ACCESS_TYPE, \ 01165 LINKAGE_TYPE, \ 01166 RESULT_TYPE, \ 01167 NAME, \ 01168 ID \ 01169 ) 01170 #else 01171 #define MIRROR_REG_MEM_FUNCTION_BEGIN( \ 01172 ACCESS_TYPE, \ 01173 LINKAGE_TYPE, \ 01174 RESULT_TYPE, \ 01175 NAME, \ 01176 ID \ 01177 ) \ 01178 memfn_idx_ ## ID; \ 01179 typedef member< \ 01180 spec_ ## ACCESS_TYPE ## _tag, \ 01181 spec_ ## LINKAGE_TYPE ## _tag, \ 01182 RESULT_TYPE \ 01183 > memfn_ ## ID; \ 01184 static memfn_ ## ID memfn_traits(memfn_idx_ ## ID); \ 01185 template <typename _That> \ 01186 struct memfn_wrapper_ ## ID \ 01187 { \ 01188 _That& instance; \ 01189 memfn_wrapper_ ## ID(_That& inst) \ 01190 : instance(inst) \ 01191 { } \ 01192 \ 01193 template <typename ... _Params > \ 01194 RESULT_TYPE operator()(_Params ... params) const \ 01195 { \ 01196 return instance.NAME(params ... ); \ 01197 } \ 01198 };\ 01199 struct memfn_params_ ## ID \ 01200 { \ 01201 typedef std::integral_constant<int, 0> 01202 #endif 01203 01204 #ifdef MIRROR_DOCUMENTATION_ONLY 01205 01206 01228 #define MIRROR_REG_MEM_FUNCTION_END(ID, CONST) 01229 #else 01230 #define MIRROR_REG_MEM_FUNCTION_END(ID, CONST) \ 01231 size; \ 01232 }; \ 01233 static memfn_params_ ## ID memfn_params( \ 01234 memfn_idx_ ## ID \ 01235 ); \ 01236 static spec_ ## CONST ## _tag memfn_constness(memfn_idx_ ## ID);\ 01237 static memfn_wrapper_ ## ID < \ 01238 aux::memfn_inst_type<spec_ ## CONST ## _tag, _this>::type \ 01239 > memfn_wrapper( \ 01240 memfn_idx_ ## ID, \ 01241 aux::memfn_inst_type<spec_ ## CONST ## _tag, _this>::type& inst\ 01242 ) \ 01243 { \ 01244 return memfn_wrapper_ ## ID < \ 01245 aux::memfn_inst_type<spec_ ## CONST ## _tag, _this>::type\ 01246 >(inst); \ 01247 } \ 01248 typedef std::integral_constant<int, memfn_idx_ ## ID ::value + 1> 01249 #endif 01250 01251 #ifdef MIRROR_DOCUMENTATION_ONLY 01252 01253 01273 #define MIRROR_REG_CLASS_CONVERSIONS(TYPELIST) 01274 #else 01275 #define MIRROR_REG_CLASS_CONVERSIONS(TYPELIST) \ 01276 typedef mp::range< \ 01277 MIRROR_PP_EXPAND_ARGS TYPELIST \ 01278 > conv_ops; 01279 #endif 01280 01281 #ifdef MIRROR_DOCUMENTATION_ONLY 01282 01283 01299 #define MIRROR_FRIENDLY_CLASS(CLASS) 01300 #else 01301 #define MIRROR_FRIENDLY_CLASS(CLASS) \ 01302 friend class mirror::_class::_< CLASS > 01303 #endif 01304 01305 template <class Class, class BaseMetaInheritance> 01306 struct meta_inheritance 01307 { 01308 typedef meta_class<Class> derived_class; 01309 01310 typedef typename aux::inheritance_type_tag< 01311 typename BaseMetaInheritance::inherit 01312 >::type inheritance_type; 01313 01314 typedef typename aux::access_type_tag< 01315 typename _class::_<Class>::kind, 01316 typename BaseMetaInheritance::access 01317 >::type access_type; 01318 01319 typedef meta_class<typename BaseMetaInheritance::base> base_class; 01320 }; 01321 01322 01323 template <class Class, int Index> 01324 struct meta_member_variable 01325 { 01326 private: 01327 typedef std::integral_constant<int, Index> _idx; 01328 // Get the base traits of the type from the registered function 01329 typedef decltype( 01330 mirror::_class::_<Class>::attr_traits(_idx()) 01331 ) _base_traits; 01332 public: 01333 01334 typedef meta_class< Class > scope; 01335 01336 typedef typename aux::access_type_tag< 01337 typename mirror::_class::_<Class>::kind, 01338 typename _base_traits::access_type 01339 >::type access_type; 01340 01341 typedef typename aux::storage_class_tag_mv< 01342 typename _base_traits::storage_class 01343 >::type storage_class; 01344 01345 typedef typename aux::reflect_type< 01346 typename _base_traits::type_sel 01347 >::type type; 01348 01349 private: 01350 template <typename Local> 01351 static std::string make_name(Local local) 01352 { 01353 // get the full or local name of the scope 01354 std::string result( 01355 Local::value ? 01356 scope::local_name() : 01357 scope::full_name() 01358 ); 01359 // append the separating double colon 01360 result.append("::"); 01361 // and append the base name of this member variable 01362 result.append(base_name()); 01363 // return the result 01364 return result; 01365 } 01366 public: 01367 typedef decltype( 01368 mirror::_class::_<Class>::attr_ct_name(_idx()) 01369 ) static_name; 01370 01371 // returns the base name of the member variable 01372 static std::string base_name(void) 01373 { 01374 return std::string( 01375 mirror::_class::_<Class>::attr_name(_idx()), 01376 mirror::_class::_<Class>::attr_name_length(_idx()) 01377 ); 01378 } 01379 01380 // returns the full name (including the full nested name qualifier) 01381 static std::string full_name(void) 01382 { 01383 return make_name(std::false_type()); 01384 } 01385 01386 // returns the local name (including partial nested name qualifier) 01387 static std::string local_name(void) 01388 { 01389 return make_name(std::true_type()); 01390 } 01391 01392 // returns the value of the member when given a reference to Class 01393 static auto get(const Class& inst) -> 01394 decltype(mirror::_class::_<Class>::get(_idx(), inst)) 01395 { 01396 return mirror::_class::_<Class>::get(_idx(), inst); 01397 } 01398 01399 // sets the value of the member when given a reference to Class 01400 template <typename ValueType> 01401 static void set(Class& inst, const ValueType& value) 01402 { 01403 mirror::_class::_<Class>::set(_idx(), inst, value); 01404 } 01405 01406 private: 01407 typedef decltype(mirror::_class::_<Class>::has_address(_idx())) 01408 has_address; 01409 01410 friend struct meta_object_category<meta_member_variable>; 01411 public: 01412 // gets the address of the member variable if possible 01413 // users should always check if the meta-variable conforms 01414 // to MetaPlainMemberVariable before trying to call address() 01415 static auto address(Class& inst) -> 01416 decltype(mirror::_class::_<Class>::address(_idx(), inst)) 01417 { 01418 return mirror::_class::_<Class>::address(_idx(), inst); 01419 } 01420 01421 // gets the address of the member variable if possible 01422 static auto address(const Class& inst) -> 01423 decltype(mirror::_class::_<Class>::address(_idx(), inst)) 01424 { 01425 return mirror::_class::_<Class>::address(_idx(), inst); 01426 } 01427 01428 // gets the address of the member variable if possible 01429 static auto member_pointer(void) -> 01430 decltype(mirror::_class::_<Class>::mem_ptr(_idx())) 01431 { 01432 return mirror::_class::_<Class>::mem_ptr(_idx()); 01433 } 01434 01435 // NOTE: internal implementation detail do not use 01436 template <typename X> 01437 struct _by_name_typ 01438 { 01439 typedef decltype( 01440 mirror::_class::_<Class>::by_name_typ( 01441 _idx(), 01442 (X*)nullptr 01443 ) 01444 ) type; 01445 }; 01446 01447 // NOTE: internal implementation detail do not use 01448 template <typename X> 01449 struct _by_name_val 01450 { 01451 typedef decltype( 01452 mirror::_class::_<Class>::by_name_val( 01453 _idx(), 01454 (X*)nullptr 01455 ) 01456 ) type; 01457 }; 01458 }; 01459 01460 template <class Class, int Index> 01461 struct meta_object_category< meta_member_variable<Class, Index> > 01462 { 01463 private: 01464 typedef meta_member_variable<Class, Index> mmv; 01465 01466 static meta_member_variable_tag _get_type(std::false_type); 01467 01468 static meta_plain_member_variable_tag _get_type(std::true_type); 01469 public: 01470 typedef decltype(_get_type(typename mmv::has_address())) type; 01471 }; 01472 01473 template <class Class> 01474 struct meta_class 01475 : public meta_type<Class> 01476 { 01477 typedef typename aux::elaborated_type_tag< 01478 typename _class::_<Class>::kind 01479 >::type elaborated_type; 01480 }; 01481 01482 #ifdef MIRROR_DOCUMENTATION_ONLY 01483 01484 01499 #define MIRRORED_CLASS(FULL_CLASS_NAME) mirror::MetaClass 01500 #else 01501 #define MIRRORED_CLASS(FULL_CLASS_NAME) \ 01502 mirror::meta_class< FULL_CLASS_NAME > 01503 #endif 01504 01505 // The implementation of base_classes for instantiation of meta_class 01506 template <class Class> 01507 struct base_classes<meta_class<Class> > 01508 { 01509 // A range of MetaInheritances reflecting the base-classes 01510 typedef typename aux::base_classes_helper< 01511 Class, 01512 typename _class::_<Class>::base_classes 01513 >::type type; 01514 }; 01515 01516 // The implementation of member_variables for instantiation of meta_class 01517 template <class Class> 01518 struct member_variables<meta_class<Class> > 01519 { 01520 // A range of MetaMemberVariables reflecting the member variables 01521 typedef typename mp::apply_on_seq_pack< 01522 aux::mem_var_helper<Class>, 01523 typename mirror::_class::_<Class>::attr_count 01524 >::type type; 01525 }; 01526 01527 // The implementation of the class_layout meta-function for meta-classes 01528 template <class Class> 01529 struct class_layout<meta_class<Class> > 01530 { 01531 private: 01532 typedef aux::class_layout_helper< 01533 typename base_classes< 01534 meta_class<Class> 01535 >::type, 01536 meta_class<Class>, 01537 spec_non_virtual_tag 01538 > helper; 01539 public: 01540 01541 // the resulting range contains MetaClass(es) 01542 // in an order reflecting the layout of the class 01543 typedef typename mp::concat< 01544 typename mp::unique<typename helper::virt>::type, 01545 typename helper::reg 01546 >::type type; 01547 }; 01548 01549 // Implementation of the all_member_variables meta-function for meta-classes 01550 template <class Class> 01551 struct all_member_variables<meta_class<Class> > 01552 { 01553 // the returned range contains MetaMemberVariables 01554 // reflecting the individual member variables of the Class 01555 typedef typename mp::fold< 01556 class_layout<meta_class<Class> >, 01557 mp::range<>, 01558 mp::concat< 01559 mp::arg<1>, 01560 member_variables<mp::arg<2> > 01561 > 01562 >::type type; 01563 }; 01564 01565 01566 // implementation of the meta_constructor template 01567 template <typename Type, int Index> 01568 class meta_constructor 01569 : public aux::scoped_named_impl< 01570 aux::meta_constructor_base<Type, Index> 01571 > 01572 { 01573 private: 01574 typedef std::integral_constant<int, Index> _idx; 01575 public: 01576 // the scope of the constructor 01577 typedef meta_class< Type > scope; 01578 01579 typedef typename aux::access_type_tag< 01580 typename _class::_<Type>::kind, 01581 decltype(_class::_<Type>::ctr_access(_idx())) 01582 >::type access_type; 01583 01584 // the result of the constructor 01585 typedef typename aux::reflect_type<Type>::type result_type; 01586 typedef spec_static_tag storage_class; 01587 typedef spec_static_tag linkage; 01588 01589 typedef decltype(_class::_<Type>::ctr_kind(_idx())) kind; 01590 }; 01591 01592 // The implementation of constructors for instantiations of meta_class 01593 template <class Type> 01594 struct constructors<meta_type<Type> > 01595 { 01596 // A range of MetaMemberVariables reflecting the member variables 01597 typedef typename mp::apply_on_seq_pack< 01598 aux::constructor_helper<Type>, 01599 typename mirror::_class::_<Type>::ctr_count 01600 >::type type; 01601 }; 01602 01603 // The implementation of constructors for instantiations of meta_class 01604 template <class Class> 01605 struct constructors<meta_class<Class> > 01606 : constructors<meta_type<Class> > 01607 { }; 01608 01609 // Implementation of meta_constructor_param template 01610 template <typename Type, int ConstrIndex, int ParamIndex> 01611 struct meta_constructor_param 01612 : public aux::scoped_named_impl< 01613 aux::meta_ctr_param_base< 01614 Type, 01615 ConstrIndex, 01616 ParamIndex 01617 > 01618 > 01619 { 01620 private: 01621 typedef mirror::_class::_<Type> base_meta_type; 01622 typedef decltype( 01623 base_meta_type::ctr_params( 01624 std::integral_constant<int, ConstrIndex>() 01625 ).type( 01626 std::integral_constant<int, ParamIndex>() 01627 ) 01628 ) type_helper; 01629 public: 01630 typedef decltype( 01631 base_meta_type::ctr_params( 01632 std::integral_constant<int, ConstrIndex>() 01633 ).ct_name( 01634 std::integral_constant<int, ParamIndex>() 01635 ) 01636 ) static_name; 01637 01638 typedef spec_auto_tag storage_class; 01639 01640 typedef meta_constructor<Type, ConstrIndex> scope; 01641 01642 typedef typename aux::reflect_type< 01643 typename type_helper::type 01644 >::type type; 01645 01646 // the type of the constructor parameter 01647 typedef std::integral_constant<int, ParamIndex> position; 01648 }; 01649 01650 // Implementation of the parameters meta-function template class 01651 template <typename Type, int ConstrIndex> 01652 struct parameters<meta_constructor<Type, ConstrIndex> > 01653 { 01654 private: 01655 typedef decltype( 01656 mirror::_class::_<Type> 01657 ::ctr_params( 01658 std::integral_constant<int, ConstrIndex >() 01659 ) 01660 ) size_helper; 01661 public: 01662 // A range of MetaVariables reflecting 01663 // the parameters of a meta-constructor 01664 typedef typename mp::apply_on_seq_pack< 01665 aux::ctr_param_helper<Type, ConstrIndex>, 01666 typename size_helper::size 01667 >::type type; 01668 }; 01669 01670 // implementation of the meta_initializer template 01671 template <typename Type> 01672 class meta_initializer 01673 : public aux::scoped_named_impl< 01674 aux::meta_ctr_base_base<Type> 01675 > 01676 { 01677 public: 01678 typedef typename meta_class< Type >::static_name static_name; 01679 01680 typedef meta_class< Type > scope; 01681 01682 typedef spec_public_tag access_type; 01683 01684 typedef typename aux::reflect_type<Type>::type result_type; 01685 typedef spec_static_tag storage_class; 01686 typedef spec_static_tag linkage; 01687 01688 typedef struct_initializer_tag kind; 01689 }; 01690 01691 // Implementation of meta_constructor_param template 01692 template <typename Type> 01693 struct meta_initializer_param 01694 : public aux::scoped_named_impl<aux::meta_initlzr_param_base<Type> > 01695 { 01696 typedef typename mirror::cts::string<>::type static_name; 01697 01698 typedef spec_auto_tag storage_class; 01699 01700 typedef meta_initializer<Type> scope; 01701 01702 typedef typename aux::reflect_type<Type>::type type; 01703 01704 typedef std::integral_constant<int, 0> position; 01705 }; 01706 01707 // Implementation of the parameters meta-function template class 01708 template <typename Type> 01709 struct parameters<meta_initializer<Type> > 01710 { 01711 typedef mp::range<meta_initializer_param<Type> > type; 01712 }; 01713 01714 01715 // implementation of the meta_member_function template 01716 template <typename Class, int FuncIndex, int OvldIndex> 01717 class meta_member_function 01718 : public aux::scoped_named_impl< 01719 aux::meta_mem_function_base<Class, FuncIndex> 01720 > 01721 { 01722 private: 01723 typedef std::integral_constant<int, FuncIndex> _func_idx; 01724 typedef std::integral_constant<int, OvldIndex> _ovld_idx; 01725 01726 // the set of overloaded functions 01727 typedef decltype( 01728 _class::_<Class>:: 01729 mem_ovldfn(_func_idx()) 01730 ) _ovld_funcs; 01731 01732 // the traits for this specific overload 01733 typedef decltype( 01734 _ovld_funcs::memfn_traits(_ovld_idx()) 01735 ) _base_traits; 01736 public: 01737 typedef mirror::meta_class<Class> scope; 01738 01739 typedef typename aux::access_type_tag< 01740 typename _class::_<Class>::kind, 01741 typename _base_traits::access_type 01742 >::type access_type; 01743 01744 typedef typename aux::storage_class_tag_mf< 01745 typename _base_traits::storage_class 01746 >::type storage_class; 01747 typedef storage_class linkage; 01748 01749 // the result of the constructor 01750 typedef typename aux::reflect_type< 01751 typename _base_traits::type_sel 01752 >::type result_type; 01753 01754 typedef typename aux::constness_tag< 01755 decltype( 01756 _ovld_funcs:: 01757 memfn_constness(_ovld_idx()) 01758 ) 01759 >::type constness; 01760 01761 // makes an instance of the wrapper which allows 01762 // to call the member function reflected by this 01763 // MetaMemberFunction 01764 static inline auto wrap(Class& instance) -> 01765 decltype(_ovld_funcs::memfn_wrapper( 01766 _ovld_idx(), 01767 instance 01768 )) 01769 { 01770 return _ovld_funcs::memfn_wrapper( 01771 _ovld_idx(), 01772 instance 01773 ); 01774 } 01775 }; 01776 01777 template <typename Class, int FuncIndex> 01778 class meta_ovlded_mem_funcs 01779 : public aux::scoped_named_impl< 01780 aux::meta_mem_function_base<Class, FuncIndex> 01781 > 01782 { 01783 private: 01784 typedef mirror::_class::_<Class> base_meta_class; 01785 public: 01786 typedef decltype(mirror::_class::_<Class>::memfn_ct_name( 01787 std::integral_constant<int, FuncIndex>() 01788 )) static_name; 01789 01790 typedef mirror::meta_class<Class> scope; 01791 }; 01792 01793 // The implementation of member_functions for instantiations of meta_class 01794 template <class Class> 01795 struct member_functions<meta_class<Class> > 01796 { 01797 // A range of MetaOverloadedFunctions reflecting the overloaded functions 01798 typedef typename mp::apply_on_seq_pack< 01799 aux::mem_ovlded_func_helper<Class>, 01800 typename mirror::_class::_<Class>::mem_ovldfn_count 01801 >::type type; 01802 }; 01803 01804 // The implementation of overloads for meta_ovlded_mem_funcs 01805 template <class Class, int FuncIndex> 01806 struct overloads<meta_ovlded_mem_funcs<Class, FuncIndex> > 01807 { 01808 typedef decltype( 01809 mirror::_class::_<Class>::mem_ovldfn( 01810 std::integral_constant<int, FuncIndex>() 01811 ) 01812 ) _ovld_fns; 01813 // A range of MetaMemberFunctions reflecting the member functions 01814 typedef typename mp::apply_on_seq_pack< 01815 aux::mem_function_helper<Class, FuncIndex>, 01816 typename _ovld_fns::memfn_count 01817 >::type type; 01818 }; 01819 01820 template <typename Class, int FuncIndex, int OvldIndex, int ParamIndex> 01821 struct meta_mem_function_param 01822 : public aux::scoped_named_impl< 01823 aux::meta_memfn_param_base< 01824 Class, 01825 FuncIndex, 01826 OvldIndex, 01827 ParamIndex 01828 > 01829 > 01830 { 01831 private: 01832 typedef mirror::_class::_<Class> base_meta_type; 01833 typedef decltype( 01834 base_meta_type::mem_ovldfn( 01835 std::integral_constant<int, FuncIndex>() 01836 ).memfn_params( 01837 std::integral_constant<int, OvldIndex>() 01838 ).type( 01839 std::integral_constant<int, ParamIndex>() 01840 ) 01841 ) type_helper; 01842 public: 01843 typedef decltype( 01844 base_meta_type::mem_ovldfn( 01845 std::integral_constant<int, FuncIndex>() 01846 ).memfn_params( 01847 std::integral_constant<int, OvldIndex>() 01848 ).ct_name( 01849 std::integral_constant<int, ParamIndex>() 01850 ) 01851 ) static_name; 01852 01853 typedef spec_auto_tag storage_class; 01854 01855 typedef meta_member_function<Class, FuncIndex, OvldIndex> scope; 01856 01857 // the type of the function parameter 01858 typedef meta_class< typename type_helper::type > type; 01859 01860 // the position of the function parameter 01861 typedef std::integral_constant<int, ParamIndex> position; 01862 01863 }; 01864 01865 01866 // Implementation of the parameters meta-function template class 01867 template <typename Class, int FuncIndex, int OvldIndex> 01868 struct parameters<meta_member_function<Class, FuncIndex, OvldIndex> > 01869 { 01870 private: 01871 typedef decltype( 01872 mirror::_class::_<Class>:: 01873 mem_ovldfn( 01874 std::integral_constant<int, FuncIndex >() 01875 ).memfn_params( 01876 std::integral_constant<int, OvldIndex >() 01877 ) 01878 ) size_helper; 01879 public: 01880 // A range of MetaVariables reflecting 01881 // the parameters of a meta-constructor 01882 typedef typename mp::apply_on_seq_pack< 01883 aux::memfn_param_helper<Class, FuncIndex, OvldIndex>, 01884 typename size_helper::size 01885 >::type type; 01886 }; 01887 01888 01889 // implementation of the meta_conversion_operator template 01890 template <typename Class, typename Result> 01891 class meta_conversion_operator 01892 : public aux::scoped_named_impl< 01893 aux::meta_conv_op_base<Class, Result> 01894 > 01895 { 01896 public: 01897 typedef mirror::meta_class<Class> scope; 01898 01899 typedef spec_public_tag access_type; 01900 01901 typedef spec_auto_tag storage_class; 01902 typedef spec_auto_tag linkage; 01903 01904 typedef mirror::meta_class<Result> result_type; 01905 }; 01906 01907 // The implementation of conversions for instantiations of meta_class 01908 template <class Class> 01909 struct conversions<meta_class<Class> > 01910 { 01911 private: 01912 typedef mirror::_class::_<Class> base_meta_class; 01913 public: 01914 // A range of MetaConversionOperators reflecting the conversions 01915 typedef typename aux::conv_op_helper< 01916 Class, 01917 typename base_meta_class::conv_ops 01918 >::type type; 01919 }; 01920 01921 01922 // Implementation of the parameters meta-function template class 01923 template <typename Class, typename Result> 01924 struct parameters<meta_conversion_operator<Class, Result> > 01925 { 01926 public: 01927 // An empty range reflecting 01928 // the parameters of a conversion operator 01929 typedef typename mp::range<> type; 01930 }; 01931 01932 01933 // Implementation of the members meta-function for constructors 01934 template <typename Type, int ConstrIndex> 01935 struct members<meta_constructor<Type, ConstrIndex> > 01936 { 01937 typedef typename parameters< 01938 meta_constructor<Type, ConstrIndex> 01939 >::type type; 01940 }; 01941 01942 template <typename Type> 01943 struct members<meta_initializer<Type> > 01944 { 01945 typedef typename parameters<meta_initializer<Type> >::type type; 01946 }; 01947 01948 // Implementation of the members meta-function for functions 01949 template <typename Type, int FuncIndex, int OvldIndex> 01950 struct members<meta_member_function<Type, FuncIndex, OvldIndex> > 01951 { 01952 typedef typename parameters< 01953 meta_member_function<Type, FuncIndex, OvldIndex> 01954 >::type type; 01955 }; 01956 01957 // Implementation of the members meta-function for conversion operators 01958 template <typename Class, typename Result> 01959 struct members<meta_conversion_operator<Class, Result> > 01960 { 01961 typedef typename parameters< 01962 meta_conversion_operator<Class, Result> 01963 >::type type; 01964 }; 01965 01966 // Implementation of the members meta-function for classes 01967 template <class Class> 01968 struct members<meta_class<Class> > 01969 { 01970 //TODO: this should be finished when other class members 01971 // are supported 01972 typedef typename all_member_variables< 01973 meta_class<Class> 01974 >::type type; 01975 }; 01976 01977 MIRROR_NAMESPACE_END 01978 01979 #endif //include guard 01980