proto-1.0 175: Handling a comma in macros and new cases in is_a.

2005-04-29 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr> * mlc/properties.hh (mlc_type_2_of_, mlc_type_2_of): New macros for types having a comma in their name. * mlc/typedef.hh: Cosmetic. * mlc/is_a.hh (template_l_template_l_class_g_class_g_class_): New case. (template_l_template_l_class_class_g_class_g_class_): New case. Index: mlc/properties.hh =================================================================== --- mlc/properties.hh (revision 174) +++ mlc/properties.hh (working copy) @@ -222,12 +222,20 @@ FromType, \ Namespace::internal::typedef_::Alias##_type>::ret +# define mlc_type_2_of_(Namespace, Category, FromType,_2, Alias) \ + Namespace::internal::f_get_type<Category, \ + FromType,_2, \ + Namespace::internal::typedef_::Alias##_type>::ret + # define mlc_type_of(Namespace, Category, FromType, Alias) \ typename mlc_type_of_(Namespace, Category, FromType, Alias) +# define mlc_type_2_of(Namespace, Category, FromType,_2, Alias) \ +typename mlc_type_2_of_(Namespace, Category, FromType,_2, Alias) + // FIXME: TODO-list // // f_get_type lance d'une part f_rec_get_prop et d'autre part f_rec_get_type Index: mlc/typedef.hh =================================================================== --- mlc/typedef.hh (revision 174) +++ mlc/typedef.hh (working copy) @@ -119,7 +119,7 @@ /*! \macro mlc_typedef_of( FromType, TypedefName ) ** ** FIXME -** Sample use: mlc_typedef_of(vector_t, value_type) +** Sample use: mlc_typedef_of(std::vector<int>, value_type) */ # define mlc_typedef_of_(FromType, TypedefName) \ \ Index: mlc/is_a.hh =================================================================== --- mlc/is_a.hh (revision 174) +++ mlc/is_a.hh (working copy) @@ -67,8 +67,9 @@ enum { class_ = 1, template_l_class_g_class_ = 2, - template_l_class_class_g_class_ = 3 - // template_l_unsigned_class_g_class_ = 4 + template_l_class_class_g_class_ = 3, + template_l_template_l_class_g_class_g_class_ = 4, + template_l_template_l_class_class_g_class_g_class_ = 5 // ... }; @@ -76,18 +77,21 @@ struct desc { char dummy[id]; }; - template<class T> + template < class T> static desc< class_ > get(); - template<template<class> class T> + template < template < class > class T> static desc< template_l_class_g_class_ > get(); - template<template<class,class> class T> + template< template < class,class > class T> static desc< template_l_class_class_g_class_ > get(); - // template<template<unsigned,class> class T> - // static desc < template_l_unsigned_class_g_class_ > get(); + template< template < template < class > class > class T> + static desc< template_l_template_l_class_g_class_g_class_ > get(); + template< template < template < class,class > class > class T> + static desc< template_l_template_l_class_class_g_class_g_class_ > get(); + // ... } @@ -104,15 +108,14 @@ template<unsigned id> struct is_a_; - // _class_ + // class_ - template<> struct is_a_< form::class_ > { typedef is_a_< form::class_ > self; - template<class T, class U> + template<class T, class U> struct helper { static yes_ check(U*); @@ -120,7 +123,7 @@ static T* makeT(); }; - template<class T, class U> + template<class T, class U> struct check : public value<bool,( is_a__check_result_ )> { @@ -134,7 +137,7 @@ { typedef is_a_< form::template_l_class_g_class_ > self; - template<class T, template<class> class U> + template<class T, template < class > class U> struct helper { template<class V> @@ -143,21 +146,21 @@ static T* makeT(); }; - template<class T, template<class> class U> + template<class T, template < class > class U> struct check : public value<bool,( is_a__check_result_ )> { }; }; - // templatee_l_class_class_g_class_ + // template_l_class_class_g_class_ template<> struct is_a_< form::template_l_class_class_g_class_ > { typedef is_a_< form::template_l_class_class_g_class_ > self; - template<class T, template<class,class> class U> + template<class T, template < class,class > class U> struct helper { template<class V, class W> @@ -166,12 +169,56 @@ static T* makeT(); }; - template<class T, template<class,class> class U> + template<class T, template < class,class > class U> struct check : public value<bool,( is_a__check_result_ )> {}; }; + // template_l_template_l_class_g_class_g_class_ + + template<> + struct is_a_< form::template_l_template_l_class_g_class_g_class_ > + { + typedef is_a_< form::template_l_template_l_class_g_class_g_class_ > self; + + template<class T, template < template < class > class > class U> + struct helper + { + template<template<class> class V> + static yes_ check(U<V>*); + static no_ check(...); + static T* makeT(); + }; + + template<class T, template < template < class > class > class U> + struct check + : public value<bool,( is_a__check_result_ )> + {}; + }; + + // template_l_template_l_class_class_g_class_g_class_ + + template<> + struct is_a_< form::template_l_template_l_class_class_g_class_g_class_ > + { + typedef is_a_< form::template_l_template_l_class_class_g_class_g_class_ > self; + + template<class T, template < template < class,class > class > class U> + struct helper + { + template<template<class,class> class V> + static yes_ check(U<V>*); + static no_ check(...); + static T* makeT(); + }; + + template<class T, template < template < class,class > class > class U> + struct check + : public value<bool,( is_a__check_result_ )> + {}; + }; + } // end of internal } // end of mlc
participants (1)
-
Thierry GERAUD