Source code of Windows XP (NT5)
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.

134 lines
2.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: genenum.hxx
  7. //
  8. // Contents: Declaration of a generic enum object and test object.
  9. //
  10. // Classes: CGenEnumObject
  11. //
  12. // Functions:
  13. //
  14. // History: dd-mmm-yy Author Comment
  15. // 23-May-94 kennethm author! author!
  16. //
  17. //--------------------------------------------------------------------------
  18. #ifndef _GENENUM_H
  19. #define _GENENUM_H
  20. #include <windows.h>
  21. #include <assert.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <ctype.h>
  26. #include <ole2.h>
  27. //
  28. // This macro allows the code to use a different outputstring function.
  29. //
  30. EXTERN_C HRESULT TestEnumerator(
  31. void *penum,
  32. size_t ElementSize,
  33. LONG ElementCount,
  34. BOOL (*verify)(void*),
  35. BOOL (*verifyall)(void*,LONG),
  36. void (*cleanup)(void*));
  37. //
  38. // Classes are exposed for C++ clients only
  39. //
  40. #ifdef __cplusplus
  41. //+-------------------------------------------------------------------------
  42. //
  43. // Class: IGenEnum
  44. //
  45. // Purpose: generic enumerator
  46. //
  47. // Interface: Abstract class
  48. //
  49. // History: dd-mmm-yy Author Comment
  50. // 23-May-94 kennethm author
  51. //
  52. // Notes:
  53. //
  54. //--------------------------------------------------------------------------
  55. class IGenEnum
  56. {
  57. public:
  58. STDMETHOD(QueryInterface)(REFIID riid, void **ppvObj) = 0;
  59. STDMETHOD_(ULONG,AddRef)(void) = 0;
  60. STDMETHOD_(ULONG,Release)(void) = 0;
  61. STDMETHOD(Next) (ULONG celt, void *rgelt,
  62. ULONG *pceltFetched) = 0;
  63. STDMETHOD(Skip) (ULONG celt) = 0;
  64. STDMETHOD(Reset) (void) = 0;
  65. STDMETHOD(Clone) (void **ppenum) = 0;
  66. };
  67. //+-------------------------------------------------------------------------
  68. //
  69. // Class: CEnumeratorTest
  70. //
  71. // Purpose: enumerator test class
  72. //
  73. // Interface:
  74. //
  75. // History: dd-mmm-yy Author Comment
  76. // 23-May-94 kennethm author
  77. //
  78. // Notes:
  79. //
  80. //--------------------------------------------------------------------------
  81. class CEnumeratorTest
  82. {
  83. public:
  84. //
  85. // Constructor
  86. //
  87. CEnumeratorTest(IGenEnum * enumtest, size_t elementsize, LONG elementcount);
  88. //
  89. // Test for each enumerator object
  90. //
  91. HRESULT TestAll(void);
  92. HRESULT TestNext(void);
  93. HRESULT TestSkip(void);
  94. HRESULT TestClone(void);
  95. HRESULT TestRelease(void);
  96. //
  97. // Verification functions
  98. //
  99. virtual BOOL Verify(void *);
  100. virtual BOOL VerifyAll(void*, LONG);
  101. virtual void Cleanup(void *);
  102. protected:
  103. CEnumeratorTest();
  104. BOOL GetNext(ULONG celt, ULONG* pceltFetched, HRESULT* phresult);
  105. IGenEnum * m_pEnumTest;
  106. size_t m_ElementSize;
  107. LONG m_ElementCount;
  108. };
  109. #endif
  110. #endif // !_GENENUM_H
  111.