本文整理汇总了C++中TypeIndex::get_info方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeIndex::get_info方法的具体用法?C++ TypeIndex::get_info怎么用?C++ TypeIndex::get_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeIndex
的用法示例。
在下文中一共展示了TypeIndex::get_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_converter_variations
void TypeSystemInstance::add_converter_variations(TypeIndex from, TypeIndex to, p_conv_t conv)
{
this->conv_graph.add_conv(from, to, conv);
/*
// Add converters to make either type const.
this->add_ptr_convs(from);
this->add_ptr_convs(to);
*/
auto from_info = from.get_info();
auto to_info = to.get_info();
// Reuse this converter for just the "to" obj const
this->conv_graph.add_conv(from, get_index(to_info.as_const_value()), conv);
// Reuse this converter for both from and to as const
this->conv_graph.add_conv(get_index(from_info.as_const_value()), get_index(to_info.as_const_value()), conv);
}
示例2: add_ptr_convs
void add_ptr_convs(TypeIndex index)
{
TypeInfo bare = index.get_info().class_type();
//add_conv_track<void>(bare);
//add_conv_track<void const>(bare.as_const_value());
auto bottom_ptr_type = create_type_mirror("BottomPtr", size_t(0), create_bottom_ptr_type_index(), type_system->global_namespace().get_class_type());
type_system->add_class(create_bottom_ptr_type_index(), bottom_ptr_type, type_system->global_namespace());
// allow unsafe_ptr_cast to convert to any type and nil (NULL) to any pointer type
add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_nonconst(), "bottom ptr unsafe cast to any ptr");
add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_const(), "bottom ptr unsafe cast to any const ptr");
// allow any ptr to be converted to void* or void const*
add_nochange_conv(bare.as_ptr_to_nonconst(), TypId<void*>::restricted().get_info(), "any ptr to void ptr");
add_nochange_conv(bare.as_ptr_to_const(), TypId<void const*>::restricted().get_info(), "any ptr to const void ptr");
}
示例3: add_converter_simple
void TypeSystemInstance::add_converter_simple(TypeIndex from_type, TypeIndex to_type, p_conv_t conv)
{
if (from_type.get_info().is_restricted)
{
stringstream msg;
msg << "add_converter_simple error from_type is restricted " << from_type.description() << " " << from_type.get_id()
<< " to " << to_type.description() << " " << to_type.get_id() << " conv='" << conv->description() << "'";
cout << msg.str() << endl;
throw std::logic_error(msg.str());
}
this->conv_graph.add_conv(from_type, to_type, conv);
//this->conv_graph.add_conv(from_type, get_index(from_type.get_info().as_restricted()), conv);
//this->conv_graph.add_conv(to_type, get_index(to_type.get_info().as_restricted()), conv);
if (!this->conv_graph.has_type(from_type))
{
stringstream msg;
msg << "add_converter_simple missing just-added from type for conversion from " << from_type.description() << " " << from_type.get_id() << " to " << to_type.description() << " " << to_type.get_id() << " conv='" << conv->description() << "'";
cout << msg.str() << endl;
//throw std::logic_error(msg.str());
}
if (!this->conv_graph.has_type(to_type))
{
stringstream msg;
msg << "add_converter_simple missing just-added to type for conversion from " << from_type.description() << " " << from_type.get_id() << " to " << to_type.description() << " " << to_type.get_id() << " conv='" << conv->description() << "'";
cout << msg.str() << endl;
//throw std::logic_error(msg.str());
}
if (!has_conv(from_type, to_type))
{
bool test_again = has_conv(from_type, to_type);
stringstream msg;
msg << test_again;
msg << "add_converter_simple missing just-added conversion from " << from_type.description() << " " << from_type.get_id() << " to " << to_type.description() << " " << to_type.get_id() << " conv='" << conv->description() << "'";
cout << msg.str() << endl;
//throw std::logic_error(msg.str());
}
}
示例4: add_common_conversions
void TypeSystemInstance::add_common_conversions(TypeIndex type)
{
TypeInfo type_info = type.get_info();
TypeInfo value_nonconst = type_info.as_nonconst_value();
TypeInfo value_const = type_info.as_const_value();
add_conv(value_nonconst, value_nonconst.as_restricted());
add_conv(value_nonconst, value_const.as_restricted());
add_conv(value_const, value_const.as_restricted());
TypeInfo ptr_to_nonconst = type_info.as_ptr_to_nonconst();
TypeInfo ref_to_nonconst = type_info.as_ref_to_nonconst();
add_conv(ptr_to_nonconst, ref_to_nonconst.as_restricted());
add_conv(ref_to_nonconst, ptr_to_nonconst.as_restricted());
TypeInfo ptr_to_const = type_info.as_ptr_to_const();
TypeInfo ref_to_const = type_info.as_ref_to_const();
add_conv(ptr_to_const, ref_to_const.as_restricted());
add_conv(ref_to_const, ptr_to_const.as_restricted());
add_conv(ptr_to_nonconst, ref_to_const.as_restricted());
add_conv(ref_to_nonconst, ptr_to_const.as_restricted());
add_conv(ptr_to_const, ptr_to_const.as_restricted());
add_conv(ref_to_const, ref_to_const.as_restricted());
add_conv(ptr_to_nonconst, ptr_to_nonconst.as_restricted());
add_conv(ref_to_nonconst, ref_to_nonconst.as_restricted());
TypeInfo const_ref_to_ptr_to_nonconst = ptr_to_nonconst.as_ref_to_nonconst();
TypeInfo const_ref_to_ptr_to_const = ptr_to_nonconst.as_ref_to_const();
add_conv(ptr_to_nonconst, const_ref_to_ptr_to_nonconst.as_restricted());
add_conv(ptr_to_nonconst, const_ref_to_ptr_to_const.as_restricted());
add_conv(ptr_to_const, const_ref_to_ptr_to_const.as_restricted());
// These have to be restricted because if refs can be converted
// to value then they can be auto-converted to script which we don't want.
add_conv(ref_to_const, value_nonconst.as_restricted());
add_conv(ref_to_const, value_const.as_restricted());
add_conv(ref_to_nonconst, value_nonconst.as_restricted());
add_conv(ref_to_nonconst, value_const.as_restricted());
add_conv(ptr_to_const, value_nonconst.as_restricted());
add_conv(ptr_to_const, value_const.as_restricted());
add_conv(ptr_to_nonconst, value_nonconst.as_restricted());
add_conv(ptr_to_nonconst, value_const.as_restricted());
// These are allowed because Term<T> can be called as ref.
add_conv(value_nonconst, ref_to_nonconst.as_restricted());
add_conv(value_nonconst, ref_to_const.as_restricted());
add_conv(value_const, ref_to_const.as_restricted());
add_conv(value_nonconst, ptr_to_nonconst.as_restricted());
add_conv(value_nonconst, ptr_to_const.as_restricted());
add_conv(value_const, ptr_to_const.as_restricted());
// Anything can be converted to it's const form without restriction.
add_conv(ref_to_nonconst, ref_to_const);
add_conv(ptr_to_nonconst, ptr_to_const);
add_conv(value_nonconst, value_const);
add_conv(ref_to_nonconst, ref_to_const.as_restricted());
add_conv(ptr_to_nonconst, ptr_to_const.as_restricted());
TypeInfo nil_expr_type = create_bottom_ptr_type_info();
add_conv(nil_expr_type, ptr_to_nonconst.as_restricted());
add_conv(nil_expr_type, ptr_to_const.as_restricted());
}