[pygccxml-commit] SF.net SVN: pygccxml: [1083] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2007-07-03 20:46:50
|
Revision: 1083 http://svn.sourceforge.net/pygccxml/?rev=1083&view=rev Author: roman_yakovenko Date: 2007-07-03 13:46:49 -0700 (Tue, 03 Jul 2007) Log Message: ----------- adding support for double type Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_repository/array_1.py pyplusplus_dev/unittests/data/global_variables_to_be_exported.cpp pyplusplus_dev/unittests/data/global_variables_to_be_exported.hpp Modified: pyplusplus_dev/pyplusplus/code_repository/array_1.py =================================================================== --- pyplusplus_dev/pyplusplus/code_repository/array_1.py 2007-06-26 05:31:20 UTC (rev 1082) +++ pyplusplus_dev/pyplusplus/code_repository/array_1.py 2007-07-03 20:46:49 UTC (rev 1083) @@ -22,6 +22,9 @@ #define __array_1_pyplusplus_hpp__ #include "boost/python.hpp" +#include "boost/mpl/if.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/type_traits/is_fundamental.hpp" //1 - dimension namespace pyplusplus{ namespace containers{ namespace static_sized{ @@ -33,11 +36,33 @@ } } +namespace details{ + +template<class T> +struct is_immutable{ + BOOST_STATIC_CONSTANT( + bool + , value = ( boost::is_same< T, std::string >::value ) + || ( boost::is_same< T, std::wstring >::value ) + || ( boost::is_fundamental< T >::value ) + || ( boost::is_enum< T >::value ) + ); + +}; + +}//details + template< class TItemType, long unsigned int size > struct const_array_1_t{ + + typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type param_type; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + details::is_immutable<TItemType>::value + , TItemType + , param_type + >::type reference_type; - typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type reference_type; - const_array_1_t( TItemType const * const data ) : m_data( data ){ if( !data ){ @@ -63,7 +88,13 @@ template< class TItemType, long unsigned int size > struct array_1_t{ - typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type reference_type; + typedef BOOST_DEDUCED_TYPENAME boost::call_traits<const TItemType>::param_type param_type; + + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + details::is_immutable<TItemType>::value + , TItemType + , param_type + >::type reference_type; array_1_t( TItemType * data ) : m_data( data ){ Modified: pyplusplus_dev/unittests/data/global_variables_to_be_exported.cpp =================================================================== --- pyplusplus_dev/unittests/data/global_variables_to_be_exported.cpp 2007-06-26 05:31:20 UTC (rev 1082) +++ pyplusplus_dev/unittests/data/global_variables_to_be_exported.cpp 2007-07-03 20:46:49 UTC (rev 1083) @@ -1,21 +1,22 @@ -// Copyright 2004 Roman Yakovenko. -// Distributed under 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) - -#include "global_variables_to_be_exported.hpp" - -namespace global_variables{ - -const color const_var = red; -color non_const_var = blue; - -data garray[10]; - -void init_garray(){ - for( int i =0; i < 10; ++i ){ - garray[i].value = -i; - } -} - -} +// Copyright 2004 Roman Yakovenko. +// Distributed under 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) + +#include "global_variables_to_be_exported.hpp" + +namespace global_variables{ + +const color const_var = red; +color non_const_var = blue; + +data garray[10]; +double arr_of_doubles[100]; + +void init_garray(){ + for( int i =0; i < 10; ++i ){ + garray[i].value = -i; + } +} + +} Modified: pyplusplus_dev/unittests/data/global_variables_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/global_variables_to_be_exported.hpp 2007-06-26 05:31:20 UTC (rev 1082) +++ pyplusplus_dev/unittests/data/global_variables_to_be_exported.hpp 2007-07-03 20:46:49 UTC (rev 1083) @@ -1,23 +1,24 @@ -// Copyright 2004 Roman Yakovenko. -// Distributed under 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) - -#ifndef __global_variables_to_be_exported_hpp__ -#define __global_variables_to_be_exported_hpp__ - -namespace global_variables{ - -enum color{ red, green, blue }; - -extern const color const_var; -extern color non_const_var; - -struct data{ int value; }; -extern data garray[10]; - -void init_garray(); - -} - -#endif//__global_variables_to_be_exported_hpp__ +// Copyright 2004 Roman Yakovenko. +// Distributed under 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) + +#ifndef __global_variables_to_be_exported_hpp__ +#define __global_variables_to_be_exported_hpp__ + +namespace global_variables{ + +enum color{ red, green, blue }; + +extern const color const_var; +extern color non_const_var; + +struct data{ int value; }; +extern data garray[10]; + +extern double arr_of_doubles[100]; +void init_garray(); + +} + +#endif//__global_variables_to_be_exported_hpp__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |