From: <rom...@us...> - 2008-12-13 12:44:31
|
Revision: 1465 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1465&view=rev Author: roman_yakovenko Date: 2008-12-13 12:44:27 +0000 (Sat, 13 Dec 2008) Log Message: ----------- remove BOOST_PYTHON_DECL from the files - should enable header-only library on Windows Modified Paths: -------------- pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-09 20:30:09 UTC (rev 1464) +++ pyplusplus_dev/indexing_suite_v2/indexing_suite/python_iterator.hpp 2008-12-13 12:44:27 UTC (rev 1465) @@ -28,7 +28,7 @@ #include <boost/python/handle.hpp> namespace boost { namespace python { namespace indexing { - struct BOOST_PYTHON_DECL python_iterator + struct /*BOOST_PYTHON_DECL*/ python_iterator { python_iterator (boost::python::object obj) : m_iter_obj (handle<> (PyObject_GetIter (obj.ptr()))), Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-09 20:30:09 UTC (rev 1464) +++ pyplusplus_dev/indexing_suite_v2/indexing_suite/slice.hpp 2008-12-13 12:44:27 UTC (rev 1465) @@ -26,7 +26,7 @@ #include <algorithm> namespace boost { namespace python { namespace indexing { - struct BOOST_PYTHON_DECL slice : public boost::python::object + struct /*BOOST_PYTHON_DECL*/ slice : public boost::python::object { // This is just a thin wrapper around boost::python::object // so that it is possible to register a special converter for @@ -61,7 +61,7 @@ {} }; - struct BOOST_PYTHON_DECL integer_slice + struct /*BOOST_PYTHON_DECL*/ integer_slice { // This class provides a convenient interface to Python slice // objects that contain integer bound and stride values. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rom...@us...> - 2010-01-13 11:43:29
|
Revision: 1799 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1799&view=rev Author: roman_yakovenko Date: 2010-01-13 11:43:23 +0000 (Wed, 13 Jan 2010) Log Message: ----------- add conditional registration of std:pair type Modified Paths: -------------- pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp Added Paths: ----------- pyplusplus_dev/indexing_suite_v2/indexing_suite/registry_utils.hpp Modified: pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp 2010-01-13 10:38:19 UTC (rev 1798) +++ pyplusplus_dev/indexing_suite_v2/indexing_suite/pair.hpp 2010-01-13 11:43:23 UTC (rev 1799) @@ -20,6 +20,7 @@ #include <boost/config.hpp> #include <indexing_suite/container_traits.hpp> #include <indexing_suite/container_suite.hpp> +#include <indexing_suite/registry_utils.hpp> #include <indexing_suite/algorithms.hpp> #include <boost/detail/workaround.hpp> @@ -36,11 +37,16 @@ typedef pair_exposer_t< TValueType, TValueCallPolicies > exposer_type; pair_exposer_t(const std::string& name){ - class_< pair_type >( name.c_str() ) - .def( "__len__", &exposer_type::len ) - .def( "__getitem__", &exposer_type::get_item ) - .add_property( "key", &exposer_type::get_key ) - .add_property( "value", &exposer_type::get_mapped ); + if( boost::python::registry::utils::is_registered< pair_type >() ){ + boost::python::registry::utils::register_alias<pair_type>( name.c_str() ); + } + else{ + class_< pair_type >( name.c_str() ) + .def( "__len__", &exposer_type::len ) + .def( "__getitem__", &exposer_type::get_item ) + .add_property( "key", &exposer_type::get_key ) + .add_property( "value", &exposer_type::get_mapped ); + } } private: Added: pyplusplus_dev/indexing_suite_v2/indexing_suite/registry_utils.hpp =================================================================== --- pyplusplus_dev/indexing_suite_v2/indexing_suite/registry_utils.hpp (rev 0) +++ pyplusplus_dev/indexing_suite_v2/indexing_suite/registry_utils.hpp 2010-01-13 11:43:23 UTC (rev 1799) @@ -0,0 +1,41 @@ +// Header file registry_utils.hpp +// +// provides few convenience functions for dealing with boost:python registry +// +// Copyright (c) 2010 Roman Yakovenko +// +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy +// at http://www.boost.org/LICENSE_1_0.txt) +// +// History +// ======= +// 2010/01/12 Roman File creation +// + +#ifndef REGISTRY_UTILS_12_01_2010_HPP +#define REGISTRY_UTILS_12_01_2010_HPP + +#include <boost/config.hpp> +#include "boost/python.hpp" +#include "boost/python/converter/registry.hpp" + +namespace boost{ namespace python{ namespace registry{ namespace utils{ + +template<class T> +bool is_registered(){ + namespace bpl = boost::python; + bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); + return class_obj.get() ? true : false; +} + +template< class T > +void register_alias( const char* name ){ + namespace bpl = boost::python; + bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); + boost::python::scope().attr( name ) = bpl::object( class_obj ); +} + +}}}} + +#endif // REGISTRY_UTILS_12_01_2010_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |