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.

221 lines
7.0 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: winstl/util/undocumented.hpp (originally MCPriv.h, ::SynesisDev)
  3. *
  4. * Purpose: Miscellaneous undocumented features.
  5. *
  6. * Created: 20th October 1994
  7. * Updated: 10th August 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 1994-2009, 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 winstl/util/undocumented.hpp
  40. *
  41. * \brief [C++ only] Miscellaneous undocumented features
  42. * (\ref group__library__utility "Utility" Library).
  43. */
  44. #ifndef WINSTL_INCL_WINSTL_UTIL_HPP_UNDOCUMENTED
  45. #define WINSTL_INCL_WINSTL_UTIL_HPP_UNDOCUMENTED
  46. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  47. #define WINSTL_VER_WINSTL_UTIL_HPP_UNDOCUMENTED_MAJOR 4
  48. #define WINSTL_VER_WINSTL_UTIL_HPP_UNDOCUMENTED_MINOR 0
  49. #define WINSTL_VER_WINSTL_UTIL_HPP_UNDOCUMENTED_REVISION 1
  50. #define WINSTL_VER_WINSTL_UTIL_HPP_UNDOCUMENTED_EDIT 36
  51. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  52. /* /////////////////////////////////////////////////////////////////////////
  53. * Includes
  54. */
  55. #ifndef WINSTL_INCL_WINSTL_H_WINSTL
  56. # include <winstl/winstl.h>
  57. #endif /* !WINSTL_INCL_WINSTL_H_WINSTL */
  58. /* /////////////////////////////////////////////////////////////////////////
  59. * Namespace
  60. */
  61. #ifndef _WINSTL_NO_NAMESPACE
  62. # if defined(_STLSOFT_NO_NAMESPACE) || \
  63. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  64. /* There is no stlsoft namespace, so must define ::winstl */
  65. namespace winstl
  66. {
  67. # else
  68. /* Define stlsoft::winstl_project */
  69. namespace stlsoft
  70. {
  71. namespace winstl_project
  72. {
  73. # endif /* _STLSOFT_NO_NAMESPACE */
  74. #endif /* !_WINSTL_NO_NAMESPACE */
  75. /* /////////////////////////////////////////////////////////////////////////
  76. * Functions
  77. */
  78. /** \brief get_undoc_clipboard_fmt__
  79. *
  80. * \ingroup group__library__utility
  81. *
  82. * \note This has to be implemented as a class, because the function version
  83. * does not correctly work in respect of the static. Specifically, it does not
  84. * distinguish between different values of the parameterising constant, so that,
  85. * say, get_undoc_clipboard_fmt__<1>(. . .) will cause fmt to be correctly
  86. * initialised, but get_undoc_clipboard_fmt__<2>(. . .) will use the same value.
  87. * This behaviour is demonstrated on VC5 & VC6, but works fine with Intel C++
  88. * 6 and 7, and VC7.
  89. */
  90. #if defined(STLSOFT_COMPILER_IS_BORLAND) || \
  91. ( defined(STLSOFT_COMPILER_IS_DMC) && \
  92. __DMC__ >= 0x829) || \
  93. defined(STLSOFT_COMPILER_IS_GCC) || \
  94. defined(STLSOFT_COMPILER_IS_INTEL) || \
  95. ( defined(STLSOFT_COMPILER_IS_MSVC) && \
  96. _MSC_VER >= 1300)
  97. template <int N>
  98. inline UINT get_undoc_clipboard_fmt__(LPCTSTR lpszFormat)
  99. {
  100. static UINT fmt = ::RegisterClipboardFormat(lpszFormat);
  101. return fmt;
  102. }
  103. #else /* ? compiler */
  104. template <int N>
  105. struct get_undoc_clipboard_fmt__
  106. {
  107. public:
  108. ss_explicit_k get_undoc_clipboard_fmt__(LPCTSTR lpszFormat)
  109. #ifdef STLSOFT_COMPILER_IS_DMC /* DMC++ pre 8.29 cannot work with the static get_() method */
  110. : m_fmt(register_(lpszFormat))
  111. #else /* ? compiler */
  112. : m_fmt(get_(lpszFormat))
  113. #endif /* compiler */
  114. {}
  115. operator UINT () const
  116. {
  117. return m_fmt;
  118. }
  119. private:
  120. static UINT register_(LPCTSTR lpszFormat)
  121. {
  122. return ::RegisterClipboardFormat(lpszFormat);
  123. }
  124. static UINT get_(LPCTSTR lpszFormat)
  125. {
  126. static UINT fmt = register_(lpszFormat);
  127. return fmt;
  128. }
  129. private:
  130. const UINT m_fmt;
  131. };
  132. #endif /* compiler */
  133. /* /////////////////////////////////////////////////////////////////////////
  134. * Constants
  135. */
  136. /* Messages */
  137. #ifndef WM_CONTEXTMENU
  138. # define WM_CONTEXTMENU (0x007B)
  139. #endif /* !WM_CONTEXTMENU */
  140. /* Clipboard formats */
  141. #ifdef __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE
  142. # pragma message(_sscomp_fileline_message("These should go into winstl_shell(_functions).h or something"))
  143. #endif /* __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE */
  144. #ifndef CF_FILENAMEA
  145. # define CF_FILENAMEA winstl_ns_qual(get_undoc_clipboard_fmt__)<1>(TEXT("FileName"))
  146. #endif /* !CF_FILENAMEA */
  147. #ifndef CF_FILENAMEW
  148. # define CF_FILENAMEW winstl_ns_qual(get_undoc_clipboard_fmt__)<2>(TEXT("FileNameW"))
  149. #endif /* !CF_FILENAMEW */
  150. #ifndef CF_FILENAME
  151. # ifdef UNICODE
  152. # define CF_FILENAME CF_FILENAMEW
  153. # else /* ? UNICODE */
  154. # define CF_FILENAME CF_FILENAMEA
  155. # endif /* UNICODE */
  156. #endif /* !CF_FILENAME */
  157. #ifndef CF_IDLIST
  158. # define CF_IDLIST winstl_ns_qual(get_undoc_clipboard_fmt__)<3>(TEXT("Shell IDList Array"))
  159. #endif /* !CF_IDLIST */
  160. #ifndef CF_NETRESOURCE
  161. # define CF_NETRESOURCE winstl_ns_qual(get_undoc_clipboard_fmt__)<4>(TEXT("Net Resource"))
  162. #endif /* !CF_NETRESOURCE */
  163. ////////////////////////////////////////////////////////////////////////////
  164. // Unit-testing
  165. #ifdef STLSOFT_UNITTEST
  166. # include "./unittest/undocumented_unittest_.h"
  167. #endif /* STLSOFT_UNITTEST */
  168. /* ////////////////////////////////////////////////////////////////////// */
  169. #ifndef _WINSTL_NO_NAMESPACE
  170. # if defined(_STLSOFT_NO_NAMESPACE) || \
  171. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  172. } // namespace winstl
  173. # else
  174. } // namespace winstl_project
  175. } // namespace stlsoft
  176. # endif /* _STLSOFT_NO_NAMESPACE */
  177. #endif /* !_WINSTL_NO_NAMESPACE */
  178. /* ////////////////////////////////////////////////////////////////////// */
  179. #endif /* WINSTL_INCL_WINSTL_UTIL_HPP_UNDOCUMENTED */
  180. /* ///////////////////////////// end of file //////////////////////////// */