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.

125 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: C O M P L I S T . H
  7. //
  8. // Contents: The basic datatype for a collection of component pointers.
  9. //
  10. // Notes:
  11. //
  12. // Author: shaunco 15 Jan 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "compdefs.h"
  17. class CComponent;
  18. // A component list is a collection of pointers to components.
  19. //
  20. class CComponentList : public CNetCfgDebug<CComponentList>,
  21. public vector<CComponent*>
  22. {
  23. public:
  24. VOID
  25. Clear ()
  26. {
  27. clear ();
  28. }
  29. UINT
  30. Count () const
  31. {
  32. return size();
  33. }
  34. BOOL
  35. FIsEmpty () const
  36. {
  37. return empty();
  38. }
  39. BOOL
  40. FComponentInList (
  41. IN const CComponent* pComponent) const
  42. {
  43. AssertH (this);
  44. AssertH (pComponent);
  45. return (find (begin(), end(), pComponent) != end());
  46. }
  47. VOID
  48. FreeComponentsNotInOtherComponentList (
  49. IN const CComponentList* pOtherList);
  50. HRESULT
  51. HrCopyComponentList (
  52. IN const CComponentList* pSourceList);
  53. HRESULT
  54. HrAddComponentsInList1ButNotInList2 (
  55. IN const CComponentList* pList1,
  56. IN const CComponentList* pList2);
  57. HRESULT
  58. HrInsertComponent (
  59. IN const CComponent* pComponent,
  60. IN DWORD dwFlags /* INS_FLAGS */);
  61. HRESULT
  62. HrReserveRoomForComponents (
  63. IN UINT cComponents);
  64. CComponent*
  65. PFindComponentByBindForm (
  66. IN NETCLASS Class OPTIONAL,
  67. IN PCWSTR pszBindForm) const;
  68. CComponent*
  69. PFindComponentByBindName (
  70. IN NETCLASS Class OPTIONAL,
  71. IN PCWSTR pszBindName) const;
  72. CComponent*
  73. PFindComponentByInstanceGuid (
  74. IN const GUID* pInstanceGuid) const;
  75. CComponent*
  76. PFindComponentByInfId (
  77. IN PCWSTR pszInfId,
  78. IN OUT ULONG* pulIndex OPTIONAL) const;
  79. CComponent*
  80. PFindComponentByPnpId (
  81. IN PCWSTR pszPnpId) const;
  82. CComponent*
  83. PGetComponentAtIndex (
  84. IN UINT unIndex) const
  85. {
  86. AssertH (this);
  87. return (unIndex < size()) ? (*this)[unIndex] : NULL;
  88. }
  89. VOID
  90. RemoveComponent (
  91. IN const CComponent* pComponent);
  92. UINT
  93. UnGetIndexOfComponent (
  94. IN const CComponent* pComponent) const
  95. {
  96. AssertH (this);
  97. const_iterator iter = find (begin(), end(), pComponent);
  98. AssertH (iter != end());
  99. AssertH ((UINT)(iter - begin()) < size());
  100. return (UINT)(iter - begin());
  101. }
  102. };