visitor_impl.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /************************************************************************************
  2. * *
  3. * Copyright (c) 2014 - 2018 Axel Menzel <info@rttr.org> *
  4. * *
  5. * This file is part of RTTR (Run Time Type Reflection) *
  6. * License: MIT License *
  7. * *
  8. * Permission is hereby granted, free of charge, to any person obtaining *
  9. * a copy of this software and associated documentation files (the "Software"), *
  10. * to deal in the Software without restriction, including without limitation *
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  12. * and/or sell copies of the Software, and to permit persons to whom the *
  13. * Software is furnished to do so, subject to the following conditions: *
  14. * *
  15. * The above copyright notice and this permission notice shall be included in *
  16. * all copies or substantial portions of the Software. *
  17. * *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
  24. * SOFTWARE. *
  25. * *
  26. *************************************************************************************/
  27. #ifndef RTTR_VISITOR_IMPL_H_
  28. #define RTTR_VISITOR_IMPL_H_
  29. namespace rttr
  30. {
  31. /////////////////////////////////////////////////////////////////////////////////////////
  32. template<typename T, typename...Base_Classes>
  33. void visitor::visit_type_begin(const type_info<T>& info)
  34. {
  35. }
  36. /////////////////////////////////////////////////////////////////////////////////////////
  37. template<typename T, typename...Base_Classes>
  38. void visitor::visit_type_end(const type_info<T>& info)
  39. {
  40. }
  41. /////////////////////////////////////////////////////////////////////////////////////////
  42. template<typename T, typename...Ctor_Args>
  43. void visitor::visit_constructor(const constructor_info<T>& info)
  44. {
  45. }
  46. /////////////////////////////////////////////////////////////////////////////////////////
  47. template<typename T>
  48. void visitor::visit_constructor_function(const constructor_function_info<T>& info)
  49. {
  50. }
  51. /////////////////////////////////////////////////////////////////////////////////////////
  52. template<typename T>
  53. void visitor::visit_method(const method_info<T>& info)
  54. {
  55. }
  56. /////////////////////////////////////////////////////////////////////////////////////////
  57. template<typename T>
  58. void visitor::visit_global_method(const method_info<T>& info)
  59. {
  60. }
  61. /////////////////////////////////////////////////////////////////////////////////////////
  62. template<typename T>
  63. void visitor::visit_property(const property_info<T>& info)
  64. {
  65. }
  66. /////////////////////////////////////////////////////////////////////////////////////////
  67. template<typename T>
  68. void visitor::visit_getter_setter_property(const property_getter_setter_info<T>& info)
  69. {
  70. }
  71. /////////////////////////////////////////////////////////////////////////////////////////
  72. template<typename T>
  73. void visitor::visit_global_property(const property_info<T>& info)
  74. {
  75. }
  76. /////////////////////////////////////////////////////////////////////////////////////////
  77. template<typename T>
  78. void visitor::visit_global_getter_setter_property(const property_getter_setter_info<T>& info)
  79. {
  80. }
  81. /////////////////////////////////////////////////////////////////////////////////////////
  82. template<typename T>
  83. void visitor::visit_readonly_property(const property_info<T>& info)
  84. {
  85. }
  86. /////////////////////////////////////////////////////////////////////////////////////////
  87. template<typename T>
  88. void visitor::visit_global_readonly_property(const property_info<T>& info)
  89. {
  90. }
  91. /////////////////////////////////////////////////////////////////////////////////////////
  92. namespace detail
  93. {
  94. /////////////////////////////////////////////////////////////////////////////////////////
  95. template<typename T, typename... Base_Classes>
  96. static visitor::type_info<type_list<T, type_list<Base_Classes...>>> make_type_visitor_info(const type& type_info)
  97. {
  98. return visitor::type_info<type_list<T, type_list<Base_Classes...>>>{type_info};
  99. }
  100. /////////////////////////////////////////////////////////////////////////////////////////
  101. template<typename T, typename Policy, typename Acc>
  102. static visitor::constructor_function_info<type_list<T, Policy, Acc>> make_ctor_info_func(const constructor& ctor, const Acc& acc)
  103. {
  104. return visitor::constructor_function_info<type_list<T, Policy, Acc>>{ctor, acc};
  105. }
  106. /////////////////////////////////////////////////////////////////////////////////////////
  107. template<typename T, typename Policy, typename...Args>
  108. static visitor::constructor_info<type_list<T, Policy, type_list<Args...>>> make_ctor_info(const constructor& ctor)
  109. {
  110. return visitor::constructor_info<type_list<T, Policy, type_list<Args...>>>{ctor};
  111. }
  112. /////////////////////////////////////////////////////////////////////////////////////////
  113. template<typename T, typename Policy, typename Acc>
  114. static visitor::method_info<type_list<T, Policy, Acc>> make_method_info(const method& meth, const Acc& acc)
  115. {
  116. return visitor::method_info<type_list<T, Policy, Acc>>{meth, acc};
  117. }
  118. /////////////////////////////////////////////////////////////////////////////////////////
  119. template<typename T, typename Policy, typename Acc>
  120. static visitor::property_info<type_list<T, Policy, Acc>> make_property_info(const property& prop, const Acc& acc)
  121. {
  122. return visitor::property_info<type_list<T, Policy, Acc>>{prop, acc};
  123. }
  124. /////////////////////////////////////////////////////////////////////////////////////////
  125. template<typename T, typename Policy, typename Getter, typename Setter>
  126. static visitor::property_getter_setter_info<type_list<T, Policy, Getter, Setter>>
  127. make_property_getter_setter_info(const property& prop,
  128. const Getter& getter,
  129. const Setter& setter)
  130. {
  131. return visitor::property_getter_setter_info<type_list<T, Policy, Getter, Setter>>{prop, getter, setter};
  132. }
  133. /////////////////////////////////////////////////////////////////////////////////////////
  134. template<typename T>
  135. struct visitor_list_wrapper
  136. {
  137. using visitor_list = type_list<>;
  138. };
  139. struct visitor_defined {};
  140. } // end namespace detail
  141. } // end namespace rttr
  142. #endif // RTTR_VISITOR_IMPL_H_