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.

124 lines
5.1 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: winstl/toolhelp/sequence_value_traits.hpp
  3. *
  4. * Purpose: Instantiations of th_sequence_value_traits<>.
  5. *
  6. * Created: 21st May 2005
  7. * Updated: 13th January 2011
  8. *
  9. * Thanks: To Pablo for contributing this great library.
  10. *
  11. * Home: http://stlsoft.org/
  12. *
  13. * Copyright (c) 2005-2011, Pablo Aguilar
  14. * Copyright (c) 2006-2011, Matthew Wilson
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without
  18. * modification, are permitted provided that the following conditions are met:
  19. *
  20. * - Redistributions of source code must retain the above copyright notice, this
  21. * list of conditions and the following disclaimer.
  22. * - Redistributions in binary form must reproduce the above copyright notice,
  23. * this list of conditions and the following disclaimer in the documentation
  24. * and/or other materials provided with the distribution.
  25. * - Neither the name(s) of Matthew Wilson and Synesis Software, nor Pablo
  26. * Aguilar, nor the names of any contributors may be used to endorse or
  27. * promote products derived from this software without specific prior written
  28. * permission.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  36. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  37. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  38. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGE.
  41. *
  42. * ////////////////////////////////////////////////////////////////////// */
  43. /** \file winstl/toolhelp/sequence_value_traits.hpp
  44. *
  45. * \brief [C++ only] Instantiations of th_sequence_value_traits<>
  46. * (\ref group__library__windows_toolhelp "Windows ToolHelp" Library).
  47. */
  48. // NO INCLUDE GUARDS
  49. // This file is meant to be included multiple times
  50. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  51. # define WINSTL_VER_WINSTL_TOOLHELP_HPP_SEQUENCE_VALUE_TRAITS_MAJOR 1
  52. # define WINSTL_VER_WINSTL_TOOLHELP_HPP_SEQUENCE_VALUE_TRAITS_MINOR 1
  53. # define WINSTL_VER_WINSTL_TOOLHELP_HPP_SEQUENCE_VALUE_TRAITS_REVISION 4
  54. # define WINSTL_VER_WINSTL_TOOLHELP_HPP_SEQUENCE_VALUE_TRAITS_EDIT 9
  55. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  56. /* Compatibility
  57. [<[STLSOFT-AUTO:NO-DOCFILELABEL]>]
  58. [<[STLSOFT-AUTO:NO-UNITTEST]>]
  59. */
  60. #ifndef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_VALUE
  61. # error This file cannot be included independently, but only within one of the toolhelp sequence specialisation headers
  62. #endif /* !WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_VALUE */
  63. #ifndef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FIRST
  64. # error This file cannot be included independently, but only within one of the toolhelp sequence specialisation headers
  65. #endif /* !WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FIRST */
  66. #ifndef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_NEXT
  67. # error This file cannot be included independently, but only within one of the toolhelp sequence specialisation headers
  68. #endif /* !WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_NEXT */
  69. #ifndef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FLAG
  70. # error This file cannot be included independently, but only within one of the toolhelp sequence specialisation headers
  71. #endif /* !WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FLAG */
  72. STLSOFT_TEMPLATE_SPECIALISATION
  73. struct th_sequence_value_traits<WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_VALUE>
  74. {
  75. typedef HANDLE handle_type;
  76. typedef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_VALUE value_type;
  77. static handle_type null_handle()
  78. {
  79. return NULL;
  80. }
  81. static handle_type invalid_handle()
  82. {
  83. return INVALID_HANDLE_VALUE;
  84. }
  85. static DWORD flag()
  86. {
  87. return WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FLAG;
  88. }
  89. static bool first(handle_type snapshot, value_type& value)
  90. {
  91. return (WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FIRST(snapshot, &value) != FALSE);
  92. }
  93. static bool next(handle_type snapshot, value_type& value)
  94. {
  95. value.dwSize = sizeof(value);
  96. return (WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_NEXT(snapshot, &value) != FALSE);
  97. }
  98. static LPCTSTR create_snapshot_fail_message()
  99. {
  100. return WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_CREATE_SNAPSHOT_FAIL_MESSAGE;
  101. }
  102. };
  103. // #undef here so we don't have to repeat this each time we include this file
  104. #undef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_VALUE
  105. #undef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FIRST
  106. #undef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_NEXT
  107. #undef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_FLAG
  108. #undef WINSTL_TH_API_SEQUENCE_VALUE_TRAITS_CREATE_SNAPSHOT_FAIL_MESSAGE
  109. /* ///////////////////////////// end of file //////////////////////////// */