/Src/Dependencies/Boost/boost/function_types/property_tags.hpp

http://hadesmem.googlecode.com/ · C++ Header · 149 lines · 108 code · 33 blank · 8 comment · 0 complexity · 8cb9950914b03c507942237a43419e0d MD5 · raw file

  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #ifndef BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
  7. #define BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
  8. #include <cstddef>
  9. #include <boost/type_traits/integral_constant.hpp>
  10. #include <boost/mpl/bitxor.hpp>
  11. namespace boost { namespace function_types {
  12. namespace detail
  13. {
  14. typedef long bits_t;
  15. template<bits_t Value> struct constant
  16. : boost::integral_constant<bits_t,Value>
  17. { };
  18. template<bits_t Bits, bits_t Mask> struct property_tag
  19. {
  20. typedef constant<Bits> bits;
  21. typedef constant<Mask> mask;
  22. };
  23. template<typename T> struct bits : T::bits { };
  24. template<typename T> struct mask : T::mask { };
  25. // forward declaration, defined in pp_tags
  26. template<bits_t Bits, bits_t CCID> struct encode_bits_impl;
  27. // forward declaration, defined in pp_tags
  28. template<bits_t LHS_bits, bits_t LHS_mask,
  29. bits_t RHS_bits, bits_t RHS_mask>
  30. struct tag_ice;
  31. // forward declaration, defined in retag_default_cc
  32. template<class Tag, class RegTag = Tag> struct retag_default_cc;
  33. template<bits_t Bits, bits_t CCID> struct encode_bits
  34. : constant<
  35. ::boost::function_types::detail::encode_bits_impl<Bits,CCID>::value
  36. >
  37. { };
  38. template<class LHS, class RHS> struct compound_tag
  39. {
  40. typedef constant<
  41. ::boost::function_types::detail::tag_ice
  42. < ::boost::function_types::detail::bits<LHS>::value
  43. , ::boost::function_types::detail::mask<LHS>::value
  44. , ::boost::function_types::detail::bits<RHS>::value
  45. , ::boost::function_types::detail::mask<RHS>::value
  46. >::combined_bits
  47. > bits;
  48. typedef constant<
  49. ::boost::function_types::detail::tag_ice
  50. < ::boost::function_types::detail::bits<LHS>::value
  51. , ::boost::function_types::detail::mask<LHS>::value
  52. , ::boost::function_types::detail::bits<RHS>::value
  53. , ::boost::function_types::detail::mask<RHS>::value
  54. >::combined_mask
  55. > mask;
  56. };
  57. template <class Base, class PropOld, class PropNew>
  58. struct changed_tag
  59. : Base
  60. {
  61. typedef mpl::bitxor_
  62. <typename Base::bits, typename PropOld::bits, typename PropNew::bits>
  63. bits;
  64. };
  65. template<class Tag, class QueryTag> struct represents_impl
  66. : boost::integral_constant<bool,
  67. ::boost::function_types::detail::tag_ice
  68. < ::boost::function_types::detail::bits<Tag>::value
  69. , ::boost::function_types::detail::mask<Tag>::value
  70. , ::boost::function_types::detail::bits<QueryTag>::value
  71. , ::boost::function_types::detail::mask<QueryTag>::value
  72. >::match
  73. >
  74. { };
  75. } // namespace detail
  76. typedef detail::property_tag<0,0> null_tag;
  77. template<class Tag1, class Tag2, class Tag3 = null_tag, class Tag4 = null_tag>
  78. struct tag
  79. : detail::compound_tag< detail::compound_tag<Tag1,Tag2>,
  80. detail::compound_tag<Tag3,Tag4> >
  81. { };
  82. #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  83. template<class Tag1, class Tag2, class Tag3> struct tag<Tag1,Tag2,Tag3,null_tag>
  84. : detail::compound_tag<detail::compound_tag<Tag1,Tag2>,Tag3>
  85. { };
  86. template<class Tag1, class Tag2> struct tag<Tag1,Tag2,null_tag,null_tag>
  87. : detail::compound_tag<Tag1,Tag2>
  88. { };
  89. template<class Tag1> struct tag<Tag1,null_tag,null_tag,null_tag>
  90. : Tag1
  91. { };
  92. #endif
  93. template<class Tag, class QueryTag> struct represents
  94. : detail::represents_impl<Tag, detail::retag_default_cc<QueryTag,Tag> >
  95. { };
  96. template<class Tag, class QueryTag> struct extract
  97. {
  98. typedef detail::constant<
  99. ::boost::function_types::detail::tag_ice
  100. < ::boost::function_types::detail::bits<Tag>::value
  101. , ::boost::function_types::detail::mask<Tag>::value
  102. , ::boost::function_types::detail::bits<QueryTag>::value
  103. , ::boost::function_types::detail::mask<QueryTag>::value
  104. >::extracted_bits
  105. > bits;
  106. typedef detail::constant<
  107. ::boost::function_types::detail::mask<QueryTag>::value
  108. > mask;
  109. };
  110. } } // namespace ::boost::function_types
  111. #include <boost/function_types/detail/pp_tags/preprocessed.hpp>
  112. namespace boost { namespace function_types {
  113. #define BOOST_FT_cc_file <boost/function_types/detail/pp_tags/cc_tag.hpp>
  114. #include <boost/function_types/detail/pp_loop.hpp>
  115. } } // namespace boost::function_types
  116. #endif