You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
7.1 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: platformstl/system/system_traits.hpp
  3. *
  4. * Purpose: Platform header for the system_traits components.
  5. *
  6. * Created: 2nd July 2006
  7. * Updated: 31st March 2010
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2006-2010, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file platformstl/system/system_traits.hpp
  40. *
  41. * \brief [C++ only] Definition of the platformstl::system_traits
  42. * type
  43. * (\ref group__library__system "System" Library).
  44. */
  45. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS
  46. #define PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS
  47. /* File version */
  48. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  49. # define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS_MAJOR 1
  50. # define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS_MINOR 2
  51. # define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS_REVISION 1
  52. # define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS_EDIT 7
  53. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  54. /* /////////////////////////////////////////////////////////////////////////
  55. * Includes
  56. */
  57. #ifndef PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_PLATFORMSTL
  58. # include <platformstl/platformstl.hpp>
  59. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_PLATFORMSTL */
  60. #if defined(PLATFORMSTL_OS_IS_UNIX)
  61. # ifndef UNIXSTL_INCL_UNIXSTL_SYSTEM_HPP_SYSTEM_TRAITS
  62. # include <unixstl/system/system_traits.hpp>
  63. # endif /* !UNIXSTL_INCL_UNIXSTL_SYSTEM_HPP_SYSTEM_TRAITS */
  64. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  65. # ifndef WINSTL_INCL_WINSTL_SYSTEM_HPP_SYSTEM_TRAITS
  66. # include <winstl/system/system_traits.hpp>
  67. # endif /* !WINSTL_INCL_WINSTL_SYSTEM_HPP_SYSTEM_TRAITS */
  68. #else /* ? operating system */
  69. # error Operating system not discriminated
  70. #endif /* operating system */
  71. /* /////////////////////////////////////////////////////////////////////////
  72. * Namespace
  73. */
  74. #if defined(_STLSOFT_NO_NAMESPACE) || \
  75. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  76. /* There is no stlsoft namespace, so must define ::platformstl */
  77. namespace platformstl
  78. {
  79. #else
  80. /* Define stlsoft::platformstl_project */
  81. namespace stlsoft
  82. {
  83. namespace platformstl_project
  84. {
  85. #endif /* _STLSOFT_NO_NAMESPACE */
  86. /* ////////////////////////////////////////////////////////////////////// */
  87. #if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  88. /** \brief Traits class for system operations.
  89. *
  90. * \ingroup group__library__system
  91. *
  92. * The class is not actually defined in the
  93. * \link ::platformstl platformstl\endlink namespace. Rather, it
  94. * resolves to the appropriate type for the given platform, relying on
  95. * \ref section__principle__conformance__intersecting_conformance "Intersecting Conformance"
  96. * of the resolved platform-specific types.
  97. *
  98. * When compiling on UNIX platforms, the platformstl::system_traits
  99. * type resolves to the unixstl::system_traits class. On Windows
  100. * platforms it resolves to the winstl::system_traits class. It
  101. * is not defined for other platforms.
  102. */
  103. template< ss_typename_param_k C
  104. >
  105. class system_traits
  106. {};
  107. #elif defined(PLATFORMSTL_OS_IS_UNIX)
  108. // Because early incarnations of Visual C++ are pretty stupid, we need to
  109. // work around their inability to introduce a template via using by
  110. // defining and deriving here
  111. # if defined(STLSOFT_COMPILER_IS_MSVC) && \
  112. _MSC_VER < 1310
  113. template <ss_typename_param_k C>
  114. struct system_traits;
  115. STLSOFT_TEMPLATE_SPECIALISATION
  116. struct system_traits<unixstl_ns_qual(us_char_a_t)>
  117. : public unixstl_ns_qual(system_traits)<unixstl_ns_qual(us_char_a_t)>
  118. {};
  119. STLSOFT_TEMPLATE_SPECIALISATION
  120. struct system_traits<unixstl_ns_qual(us_char_w_t)>
  121. : public unixstl_ns_qual(system_traits)<unixstl_ns_qual(us_char_w_t)>
  122. {};
  123. # else /* ? compiler */
  124. # ifdef _UNIXSTL_NO_NAMESPACE
  125. using ::system_traits;
  126. # else /* ? _UNIXSTL_NO_NAMESPACE */
  127. using ::unixstl::system_traits;
  128. # endif /* _UNIXSTL_NO_NAMESPACE */
  129. # endif /* compiler */
  130. #elif defined(PLATFORMSTL_OS_IS_WINDOWS)
  131. // Because early incarnations of Visual C++ are pretty stupid, we need to
  132. // work around their inability to introduce a template via using by
  133. // defining and deriving here
  134. # if defined(STLSOFT_COMPILER_IS_MSVC) && \
  135. _MSC_VER < 1310
  136. template <ss_typename_param_k C>
  137. struct system_traits;
  138. STLSOFT_TEMPLATE_SPECIALISATION
  139. struct system_traits<winstl_ns_qual(ws_char_a_t)>
  140. : public winstl_ns_qual(system_traits)<winstl_ns_qual(ws_char_a_t)>
  141. {};
  142. STLSOFT_TEMPLATE_SPECIALISATION
  143. struct system_traits<winstl_ns_qual(ws_char_w_t)>
  144. : public winstl_ns_qual(system_traits)<winstl_ns_qual(ws_char_w_t)>
  145. {};
  146. # else /* ? compiler */
  147. # ifdef _WINSTL_NO_NAMESPACE
  148. using ::system_traits;
  149. # else /* ? _WINSTL_NO_NAMESPACE */
  150. using ::winstl::system_traits;
  151. # endif /* _WINSTL_NO_NAMESPACE */
  152. # endif /* compiler */
  153. #else /* ? operating system */
  154. # error Operating system not discriminated
  155. #endif /* operating system */
  156. /* ////////////////////////////////////////////////////////////////////// */
  157. #if defined(_STLSOFT_NO_NAMESPACE) || \
  158. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  159. } // namespace platformstl
  160. #else
  161. } // namespace platformstl_project
  162. } // namespace stlsoft
  163. #endif /* _STLSOFT_NO_NAMESPACE */
  164. /* ////////////////////////////////////////////////////////////////////// */
  165. #endif /* !PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_SYSTEM_TRAITS */
  166. /* ///////////////////////////// end of file //////////////////////////// */