Beispiel #1
0
inline void register_value_type(TPythonClass &pyClass){ 
    typedef details::pair_exposer_t< TValueType, TValueCallPolicies > exposer_type;
    
    object class_name(pyClass.attr("__name__"));
    extract<std::string> class_name_extractor(class_name);
    std::string pair_name = class_name_extractor() + "_entry";
    
    exposer_type expose( pair_name );
}
        static void
        extension_def(Class& cl)
        {
            //  Wrap the map's element (value_type)
            std::string elem_name = "map_indexing_suite_";
            object class_name(cl.attr("__name__"));
            extract<std::string> class_name_extractor(class_name);
            elem_name += class_name_extractor();
            elem_name += "_entry";

            typedef typename mpl::if_<
                is_class<data_type>
              , return_internal_reference<>
              , default_call_policies
            >::type get_data_return_policy;

            class_<value_type>(elem_name.c_str())
                .def("__repr__", &DerivedPolicies::print_elem)
                .def("data", &DerivedPolicies::get_data, get_data_return_policy())
                .def("key", &DerivedPolicies::get_key)
            ;
        }