Leaked source code of windows server 2003
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.

143 lines
4.5 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. Wsbcltn.h
  5. Abstract:
  6. These classes provide support for collections (lists) of "collectable"
  7. objects.
  8. Author:
  9. Chuck Bardeen [cbardeen] 29-Oct-1996
  10. Revision History:
  11. --*/
  12. #include "resource.h"
  13. #include "Wsbpstbl.h"
  14. #ifndef _HSMMGDRC_
  15. #define _HSMMGDRC_
  16. /*++
  17. Class Name:
  18. CHsmManagedResourceCollection
  19. Class Description:
  20. A sorted collection of objects.
  21. --*/
  22. class CHsmManagedResourceCollection :
  23. public CWsbPersistStream,
  24. public IWsbIndexedCollection,
  25. public IHsmManagedResourceCollection,
  26. public IWsbTestable,
  27. public CComCoClass<CHsmManagedResourceCollection,&CLSID_CHsmManagedResourceCollection>
  28. {
  29. public:
  30. CHsmManagedResourceCollection() {}
  31. BEGIN_COM_MAP(CHsmManagedResourceCollection)
  32. COM_INTERFACE_ENTRY2(IWsbCollection, IWsbIndexedCollection)
  33. COM_INTERFACE_ENTRY(IWsbIndexedCollection)
  34. COM_INTERFACE_ENTRY(IHsmManagedResourceCollection)
  35. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  36. COM_INTERFACE_ENTRY(IPersistStream)
  37. COM_INTERFACE_ENTRY(IWsbPersistStream)
  38. COM_INTERFACE_ENTRY(IWsbTestable)
  39. END_COM_MAP()
  40. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmManagedResourceCollection)
  41. // CComObjectRoot
  42. public:
  43. STDMETHOD(FinalConstruct)(void);
  44. void FinalRelease(void);
  45. // IWsbCollection
  46. public:
  47. STDMETHOD(Add)(IUnknown* pCollectable);
  48. STDMETHOD(Contains)(IUnknown* pCollectable) {
  49. return(m_coll->Contains(pCollectable)); }
  50. STDMETHOD(Enum)(IWsbEnum** ppEnum) {
  51. return(m_coll->Enum(ppEnum)); }
  52. STDMETHOD(EnumUnknown)(IEnumUnknown** ppEnum) {
  53. return(m_coll->EnumUnknown(ppEnum)); }
  54. STDMETHOD(Find)(IUnknown* pCollectable, REFIID riid, void** ppElement) {
  55. return(m_coll->Find(pCollectable, riid, ppElement)); }
  56. STDMETHOD(GetEntries)(ULONG* pEntries) {
  57. return(m_coll->GetEntries(pEntries)); }
  58. STDMETHOD(IsEmpty)(void) {
  59. return(m_coll->IsEmpty()); }
  60. STDMETHOD(IsLocked)(void) {
  61. return(m_coll->IsLocked()); }
  62. STDMETHOD(Lock)(void) {
  63. return(m_coll->Lock()); }
  64. STDMETHOD(OccurencesOf)(IUnknown* pCollectable, ULONG* occurences) {
  65. return(m_coll->OccurencesOf(pCollectable, occurences)); }
  66. STDMETHOD(Remove)(IUnknown* pCollectable, REFIID riid, void** ppElement);
  67. STDMETHOD(RemoveAndRelease)(IUnknown* pCollectable);
  68. STDMETHOD(RemoveAllAndRelease)(void);
  69. STDMETHOD(Unlock)(void) {
  70. return(m_coll->Unlock()); }
  71. // IWsbIndexedCollection
  72. STDMETHOD(AddAt)(IUnknown* pCollectable, ULONG /*index*/) {
  73. return(Add(pCollectable)); }
  74. STDMETHOD(Append)(IUnknown* pCollectable) {
  75. return(Add(pCollectable)); }
  76. STDMETHOD(At)(ULONG index, REFIID riid, void** ppElement) {
  77. return(m_icoll->At(index, riid, ppElement)); }
  78. STDMETHOD(Copy)(ULONG start, ULONG stop, REFIID riid, void** rgElement,
  79. ULONG* pElementsFetched) {
  80. return(m_icoll->Copy(start, stop, riid, rgElement,pElementsFetched)); }
  81. STDMETHOD(CopyIfMatches)(ULONG start, ULONG stop, IUnknown* pCollectable,
  82. ULONG element, REFIID riid, void** rgElement, ULONG* pElementsFetched,
  83. ULONG* pStoppedAt) {
  84. return(m_icoll->CopyIfMatches(start, stop, pCollectable, element,
  85. riid, rgElement, pElementsFetched, pStoppedAt)); }
  86. STDMETHOD(First)(REFIID riid, void** ppElement) {
  87. return(m_icoll->First(riid, ppElement)); }
  88. STDMETHOD(Index)(IUnknown* pCollectable, ULONG* index) {
  89. return(m_icoll->Index(pCollectable, index)); }
  90. STDMETHOD(Last)(REFIID riid, void** ppElement) {
  91. return(m_icoll->Last(riid, ppElement)); }
  92. STDMETHOD(Prepend)(IUnknown* pCollectable) {
  93. return(Add(pCollectable)); }
  94. STDMETHOD(RemoveAt)(ULONG index, REFIID riid, void** ppElement) {
  95. return(m_icoll->RemoveAt(index, riid, ppElement)); }
  96. // IHsmManagedResourceCollection
  97. STDMETHOD(DeleteAllAndRelease)(void);
  98. // IPersist
  99. public:
  100. STDMETHOD(GetClassID)(LPCLSID pclsid);
  101. // IPersistStream
  102. public:
  103. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  104. STDMETHOD(Load)(IStream* pStream);
  105. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  106. // IWsbTestable
  107. public:
  108. STDMETHOD(Test)(USHORT *passed, USHORT *failed);
  109. // Data
  110. protected:
  111. CComPtr<IWsbCollection> m_coll;
  112. CComPtr<IWsbIndexedCollection> m_icoll;
  113. };
  114. #endif // _HSMMGDRC_