is_container_key_value.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /****************************************************************************
  2. **
  3. ** https://www.qxorm.com/
  4. ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
  5. **
  6. ** This file is part of the QxOrm library
  7. **
  8. ** This software is provided 'as-is', without any express or implied
  9. ** warranty. In no event will the authors be held liable for any
  10. ** damages arising from the use of this software
  11. **
  12. ** Commercial Usage
  13. ** Licensees holding valid commercial QxOrm licenses may use this file in
  14. ** accordance with the commercial license agreement provided with the
  15. ** Software or, alternatively, in accordance with the terms contained in
  16. ** a written agreement between you and Lionel Marty
  17. **
  18. ** GNU General Public License Usage
  19. ** Alternatively, this file may be used under the terms of the GNU
  20. ** General Public License version 3.0 as published by the Free Software
  21. ** Foundation and appearing in the file 'license.gpl3.txt' included in the
  22. ** packaging of this file. Please review the following information to
  23. ** ensure the GNU General Public License version 3.0 requirements will be
  24. ** met : http://www.gnu.org/copyleft/gpl.html
  25. **
  26. ** If you are unsure which license is appropriate for your use, or
  27. ** if you have questions regarding the use of this file, please contact :
  28. ** contact@qxorm.com
  29. **
  30. ****************************************************************************/
  31. #ifndef _QX_IS_CONTAINER_KEY_VALUE_H_
  32. #define _QX_IS_CONTAINER_KEY_VALUE_H_
  33. #ifdef _MSC_VER
  34. #pragma once
  35. #endif
  36. /*!
  37. * \file is_container_key_value.h
  38. * \author Lionel Marty
  39. * \ingroup QxTraits
  40. * \brief qx::trait::is_container_key_value<T>::value : return true if T is a map or hash-map (with <Key, Value> template format) container from stl, boost, Qt or QxOrm library, otherwise return false
  41. */
  42. #include <QxTraits/is_container.h>
  43. namespace qx {
  44. namespace trait {
  45. /*!
  46. * \ingroup QxTraits
  47. * \brief qx::trait::is_container_key_value<T>::value : return true if T is a map or hash-map (with <Key, Value> template format) container from stl, boost, Qt or QxOrm library, otherwise return false
  48. */
  49. template <typename T>
  50. struct is_container_key_value : public std::false_type { ; };
  51. #ifdef _QX_ENABLE_BOOST
  52. template <typename Key, typename Value>
  53. struct is_container_key_value< boost::unordered_map<Key, Value> > : public std::true_type { ; };
  54. template <typename Key, typename Value>
  55. struct is_container_key_value< boost::unordered_map<Key, Value> & > : public std::true_type { ; };
  56. template <typename Key, typename Value>
  57. struct is_container_key_value< const boost::unordered_map<Key, Value> > : public std::true_type { ; };
  58. template <typename Key, typename Value>
  59. struct is_container_key_value< const boost::unordered_map<Key, Value> & > : public std::true_type { ; };
  60. template <typename Key, typename Value>
  61. struct is_container_key_value< boost::unordered_multimap<Key, Value> > : public std::true_type { ; };
  62. template <typename Key, typename Value>
  63. struct is_container_key_value< boost::unordered_multimap<Key, Value> & > : public std::true_type { ; };
  64. template <typename Key, typename Value>
  65. struct is_container_key_value< const boost::unordered_multimap<Key, Value> > : public std::true_type { ; };
  66. template <typename Key, typename Value>
  67. struct is_container_key_value< const boost::unordered_multimap<Key, Value> & > : public std::true_type { ; };
  68. #endif // _QX_ENABLE_BOOST
  69. template <typename Key, typename Value>
  70. struct is_container_key_value< QHash<Key, Value> > : public std::true_type { ; };
  71. template <typename Key, typename Value>
  72. struct is_container_key_value< QHash<Key, Value> & > : public std::true_type { ; };
  73. template <typename Key, typename Value>
  74. struct is_container_key_value< const QHash<Key, Value> > : public std::true_type { ; };
  75. template <typename Key, typename Value>
  76. struct is_container_key_value< const QHash<Key, Value> & > : public std::true_type { ; };
  77. template <typename Key, typename Value>
  78. struct is_container_key_value< QMap<Key, Value> > : public std::true_type { ; };
  79. template <typename Key, typename Value>
  80. struct is_container_key_value< QMap<Key, Value> & > : public std::true_type { ; };
  81. template <typename Key, typename Value>
  82. struct is_container_key_value< const QMap<Key, Value> > : public std::true_type { ; };
  83. template <typename Key, typename Value>
  84. struct is_container_key_value< const QMap<Key, Value> & > : public std::true_type { ; };
  85. template <typename Key, typename Value>
  86. struct is_container_key_value< QMultiHash<Key, Value> > : public std::true_type { ; };
  87. template <typename Key, typename Value>
  88. struct is_container_key_value< QMultiHash<Key, Value> & > : public std::true_type { ; };
  89. template <typename Key, typename Value>
  90. struct is_container_key_value< const QMultiHash<Key, Value> > : public std::true_type { ; };
  91. template <typename Key, typename Value>
  92. struct is_container_key_value< const QMultiHash<Key, Value> & > : public std::true_type { ; };
  93. template <typename Key, typename Value>
  94. struct is_container_key_value< QMultiMap<Key, Value> > : public std::true_type { ; };
  95. template <typename Key, typename Value>
  96. struct is_container_key_value< QMultiMap<Key, Value> & > : public std::true_type { ; };
  97. template <typename Key, typename Value>
  98. struct is_container_key_value< const QMultiMap<Key, Value> > : public std::true_type { ; };
  99. template <typename Key, typename Value>
  100. struct is_container_key_value< const QMultiMap<Key, Value> & > : public std::true_type { ; };
  101. template <typename Key, typename Value>
  102. struct is_container_key_value< qx::QxCollection<Key, Value> > : public std::true_type { ; };
  103. template <typename Key, typename Value>
  104. struct is_container_key_value< qx::QxCollection<Key, Value> & > : public std::true_type { ; };
  105. template <typename Key, typename Value>
  106. struct is_container_key_value< const qx::QxCollection<Key, Value> > : public std::true_type { ; };
  107. template <typename Key, typename Value>
  108. struct is_container_key_value< const qx::QxCollection<Key, Value> & > : public std::true_type { ; };
  109. template <typename Key, typename Value>
  110. struct is_container_key_value< std::map<Key, Value> > : public std::true_type { ; };
  111. template <typename Key, typename Value>
  112. struct is_container_key_value< std::map<Key, Value> & > : public std::true_type { ; };
  113. template <typename Key, typename Value>
  114. struct is_container_key_value< const std::map<Key, Value> > : public std::true_type { ; };
  115. template <typename Key, typename Value>
  116. struct is_container_key_value< const std::map<Key, Value> & > : public std::true_type { ; };
  117. template <typename Key, typename Value>
  118. struct is_container_key_value< std::unordered_map<Key, Value> > : public std::true_type { ; };
  119. template <typename Key, typename Value>
  120. struct is_container_key_value< std::unordered_map<Key, Value> & > : public std::true_type { ; };
  121. template <typename Key, typename Value>
  122. struct is_container_key_value< const std::unordered_map<Key, Value> > : public std::true_type { ; };
  123. template <typename Key, typename Value>
  124. struct is_container_key_value< const std::unordered_map<Key, Value> & > : public std::true_type { ; };
  125. template <typename Key, typename Value>
  126. struct is_container_key_value< std::unordered_multimap<Key, Value> > : public std::true_type { ; };
  127. template <typename Key, typename Value>
  128. struct is_container_key_value< std::unordered_multimap<Key, Value> & > : public std::true_type { ; };
  129. template <typename Key, typename Value>
  130. struct is_container_key_value< const std::unordered_multimap<Key, Value> > : public std::true_type { ; };
  131. template <typename Key, typename Value>
  132. struct is_container_key_value< const std::unordered_multimap<Key, Value> & > : public std::true_type { ; };
  133. } // namespace trait
  134. } // namespace qx
  135. #endif // _QX_IS_CONTAINER_KEY_VALUE_H_