/************************************************************************************
* *
* Copyright (c) 2014, 2015 - 2016 Axel Menzel <info@rttr.org> *
* *
* This file is part of RTTR (Run Time Type Reflection) *
* License: MIT License *
* *
* Permission is hereby granted, free of charge, to any person obtaining *
* a copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
* SOFTWARE. *
* *
*************************************************************************************/
#ifndef RTTR_BIND_IMPL_H_
#define RTTR_BIND_IMPL_H_
#include "rttr/detail/base/core_prerequisites.h"
#include "rttr/detail/misc/argument_extractor.h"
#include "rttr/detail/constructor/constructor_wrapper.h"
#include "rttr/detail/destructor/destructor_wrapper.h"
#include "rttr/detail/enumeration/enumeration_wrapper.h"
#include "rttr/detail/enumeration/enum_data.h"
#include "rttr/detail/metadata/metadata.h"
#include "rttr/detail/method/method_wrapper.h"
#include "rttr/detail/parameter_info/parameter_infos.h"
#include "rttr/detail/property/property_wrapper.h"
#include "rttr/detail/type/accessor_type.h"
#include "rttr/detail/misc/misc_type_traits.h"
#include "rttr/detail/misc/utility.h"
#include "rttr/detail/type/type_register.h"
#include "rttr/detail/default_arguments/default_arguments.h"
#include "rttr/policy.h"
#include "rttr/type.h"
#include <functional>
#include <string>
#include <vector>
namespace rttr
{
namespace detail
{
/////////////////////////////////////////////////////////////////////////////////////////
template<typename... Args>
static RTTR_INLINE auto get_metadata(Args&&... arg) -> decltype(forward_to_array<metadata>(std::forward<Args>(arg)...))
{
return forward_to_array<metadata>(std::forward<Args>(arg)...);
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename Enum_Type, typename... Args>
static RTTR_INLINE auto get_enum_values(Args&&... arg) -> decltype(forward_to_array<enum_data<Enum_Type>>(std::forward<Args>(arg)...))
{
return forward_to_array<enum_data<Enum_Type>>(std::forward<Args>(arg)...);
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
using map_access_level_to_enum = conditional_t< std::is_same<T, detail::public_access>::value,
std::integral_constant<access_levels, access_levels::public_access>,
conditional_t< std::is_same<T, detail::protected_access>::value,
std::integral_constant<access_levels, access_levels::protected_access>,
std::integral_constant<access_levels, access_levels::private_access>
>
>;
/////////////////////////////////////////////////////////////////////////////////////////
} // end namespace detail
/////////////////////////////////////////////////////////////////////////////////////////
template<typename Class_Type, typename acc_level, typename...Ctor_Args>
class registration::bind<detail::ctor, Class_Type, acc_level, Ctor_Args...> : public registration::class_<Class_Type>
{
private:
using default_create_policy = detail::as_object;
// this additional wrapper function is needed, because of not triggered static_assert in func: 'operator()(Args&&... args)'
// when we create the object directly inside the operator function, seems to be a bug in MSVC
template<typename Policy, std::size_t Metadata_Count, typename...TArgs, typename...Param_Args>
static RTTR_INLINE std::unique_ptr<detail::constructor_wrapper_base>
create_constructor_wrapper(std::array<detail::metadata, Metadata_Count> metadata_list,
detail::default_args<TArgs...> def_args,
detail::parameter_infos<Param_Args...> param_infos)
{
using namespace detail;
return detail::make_unique<constructor_wrapper<Class_Type, class_ctor,
detail::map_access_level_to_enum<acc_level>::value,
Policy,
Metadata_Count,
default_args<TArgs...>,
parameter_infos<Param_Args...>, Ctor_Args...>>(std::move(metadata_list),
std::move(def_args),
std::move(param_infos));
}
template<typename Policy, std::size_t Metadata_Count, typename...Param_Args>
static RTTR_INLINE std::unique_ptr<detail::constructor_wrapper_base>
create_constructor_wrapper(std::array<detail::metadata, Metadata_Count> metadata_list,
detail::default_args<> def_args,
detail::parameter_infos<Param_Args...> param_infos)
{
using namespace detail;
return detail::make_unique<constructor_wrapper<Class_Type, class_ctor,
detail::map_access_level_to_enum<acc_level>::value,
Policy,
Metadata_Count,
default_args<>,
parameter_infos<Param_Args...>, Ctor_Args...>>(std::move(metadata_list),
std::move(param_infos));
}
public:
bind(const std::shared_ptr<detail::registration_executer>& reg_exec)
: registration::class_<Class_Type>(reg_exec), m_reg_exec(reg_exec)
没有合适的资源?快使用搜索试试~ 我知道了~
C++反射库--RTTR预编译包
共105个文件
h:95个
dll:4个
lib:4个
2星 需积分: 50 40 下载量 122 浏览量
2016-08-25
21:35:30
上传
评论
收藏 885KB RAR 举报
温馨提示
支持C++进行反射的库,通过对原有类进行一定得修改,不会破坏原有的类继承关系,比较简洁方便。
资源推荐
资源详情
资源评论
收起资源包目录
C++反射库--RTTR预编译包 (105个子文件)
rttr_core_d.dll 2.22MB
rttr_core_d.dll 1.5MB
rttr_core.dll 427KB
rttr_core.dll 315KB
bind_impl.h 44KB
variant.h 40KB
misc_type_traits.h 37KB
variant_data_converter.h 34KB
array_accessor_impl.h 34KB
variant_data_policy.h 33KB
type.h 33KB
registration.h 28KB
type_impl.h 19KB
variant_array_view.h 19KB
utility.h 19KB
registration_impl.h 15KB
parameter_infos.h 14KB
method.h 14KB
constructor.h 12KB
constructor_wrapper_defaults.h 12KB
constructor_wrapper.h 12KB
property_wrapper_member_func.h 12KB
property.h 12KB
default_arguments.h 11KB
policy.h 11KB
property_wrapper_func.h 10KB
method_wrapper.h 10KB
variant_impl.h 10KB
array_wrapper.h 9KB
property_wrapper_member_object.h 9KB
core_prerequisites.h 9KB
enumeration.h 9KB
invoke_with_defaults.h 9KB
property_wrapper_object.h 8KB
method_accessor.h 8KB
number_conversion.h 8KB
method_invoker.h 8KB
function_traits.h 8KB
array_mapper_impl.h 8KB
std_type_traits.h 7KB
parameter_info.h 7KB
parameter_info_wrapper.h 6KB
array_mapper.h 6KB
wrapper_mapper_impl.h 6KB
argument_extractor.h 6KB
base_classes.h 6KB
accessor_type.h 6KB
instance_impl.h 6KB
array_wrapper_base.h 6KB
argument_impl.h 6KB
type_register.h 5KB
array_accessor.h 5KB
wrapper_mapper.h 5KB
enumeration_wrapper.h 5KB
destructor.h 5KB
constructor_invoker.h 5KB
method_wrapper_base.h 5KB
compare_equal_impl.h 5KB
std_conversion_functions.h 5KB
argument.h 4KB
property_wrapper_base.h 4KB
compare_less_impl.h 4KB
compare_less.h 4KB
rttr_enable.h 4KB
compare_equal.h 4KB
constructor_wrapper_base.h 4KB
rttr_cast_impl.h 4KB
get_derived_info_func.h 4KB
type_converter.h 4KB
get_create_variant_func.h 4KB
variant_array_view_impl.h 4KB
instance.h 4KB
metadata_handler.h 4KB
metadata.h 4KB
type_comparator.h 4KB
enumeration_wrapper_base.h 3KB
registration_executer.h 3KB
prop_policies.h 3KB
argument_wrapper.h 3KB
parameter_names.h 3KB
variant_data.h 3KB
property_wrapper.h 3KB
variant_array_view_creator_impl.h 3KB
property_accessor.h 3KB
access_levels.h 3KB
enum_data.h 3KB
variant_array_view_creator.h 3KB
variant_array_view_traits.h 3KB
rttr_cast.h 3KB
destructor_wrapper.h 3KB
parameter_info_wrapper_base.h 3KB
destructor_wrapper_base.h 3KB
variant_compare_less.h 3KB
data_address_container.h 3KB
meth_policies.h 3KB
ctor_policies.h 3KB
enumeration_helper.h 3KB
bind_types.h 3KB
version.h 2KB
rttr_core_d.lib 262KB
共 105 条
- 1
- 2
资源评论
- xiaofengwei2016-12-07不是源码,使用起来不是很方便
- alexsendar2017-01-18我想打印一个类的所有变量,怎么用啊,也没个说明
jianingshow
- 粉丝: 7
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功