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.

155 lines
4.1 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: MetaUtil object
  6. File: ChkError.h
  7. Owner: t-BrianM
  8. This file contains the headers for the CheckError collection.
  9. ===================================================================*/
  10. #if !defined(AFX_CHKERROR_H__A4FA4E13_EF45_11D0_9E65_00C04FB94FEF__INCLUDED_)
  11. #define AFX_CHKERROR_H__A4FA4E13_EF45_11D0_9E65_00C04FB94FEF__INCLUDED_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #include "resource.h" // main symbols
  16. class CCheckError;
  17. /*
  18. * C C h e c k E r r o r C o l l e c t i o n
  19. *
  20. * Implements the error collection for CheckSchema and CheckKey
  21. */
  22. class CCheckErrorCollection :
  23. public IDispatchImpl<ICheckErrorCollection, &IID_ICheckErrorCollection, &LIBID_MetaUtil>,
  24. public ISupportErrorInfo,
  25. public CComObjectRoot
  26. {
  27. public:
  28. BEGIN_COM_MAP(CCheckErrorCollection)
  29. COM_INTERFACE_ENTRY(IDispatch)
  30. COM_INTERFACE_ENTRY(ICheckErrorCollection)
  31. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  32. END_COM_MAP()
  33. DECLARE_NOT_AGGREGATABLE(CCheckErrorCollection)
  34. CCheckErrorCollection();
  35. ~CCheckErrorCollection();
  36. // ISupportsErrorInfo
  37. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  38. // ICheckErrorCollection
  39. STDMETHOD(get_Count)(/*[out, retval]*/ long *plReturn);
  40. STDMETHOD(get_Item)(/*[in]*/ long lIndex, /*[out, retval]*/ LPDISPATCH * ppIReturn);
  41. STDMETHOD(get__NewEnum)(/*[out, retval]*/ LPUNKNOWN *ppIReturn);
  42. // No Interface
  43. HRESULT AddError(long lId, long lSeverity, LPCTSTR tszDescription, LPCTSTR tszKey, long lProperty);
  44. private:
  45. int m_iNumErrors;
  46. CComObject<CCheckError> *m_pCErrorList;
  47. CComObject<CCheckError> *m_pCErrorListEnd;
  48. };
  49. /*
  50. * C C h e c k E r r o r E n u m
  51. *
  52. * Implements error enumeration for CheckSchema and CheckKey
  53. */
  54. class CCheckErrorEnum :
  55. public IEnumVARIANT,
  56. public CComObjectRoot
  57. {
  58. public:
  59. CCheckErrorEnum();
  60. HRESULT Init(CComObject<CCheckError> *pCErrorList);
  61. ~CCheckErrorEnum();
  62. BEGIN_COM_MAP(CCheckErrorEnum)
  63. COM_INTERFACE_ENTRY(IEnumVARIANT)
  64. END_COM_MAP()
  65. DECLARE_NOT_AGGREGATABLE(CCheckErrorEnum)
  66. //IEnumVARIANT
  67. STDMETHOD(Next)(unsigned long ulNumToGet,
  68. VARIANT FAR* rgvarDest,
  69. unsigned long FAR* pulNumGot);
  70. STDMETHOD(Skip)(unsigned long ulNumToSkip);
  71. STDMETHOD(Reset)();
  72. STDMETHOD(Clone)(IEnumVARIANT FAR* FAR* ppIReturn);
  73. private:
  74. CComObject<CCheckError> *m_pCErrorList;
  75. CComObject<CCheckError> *m_pCErrorListPos;
  76. };
  77. /*
  78. * C C h e c k E r r o r
  79. *
  80. * Implements CheckError objects for CheckSchema and CheckKey
  81. */
  82. class CCheckError :
  83. public IDispatchImpl<ICheckError, &IID_ICheckError, &LIBID_MetaUtil>,
  84. public ISupportErrorInfo,
  85. public CComObjectRoot
  86. {
  87. public:
  88. CCheckError();
  89. HRESULT Init(long lId, long lSeverity, LPCTSTR tszDescription, LPCTSTR tszKey, long lProperty);
  90. ~CCheckError();
  91. BEGIN_COM_MAP(CCheckError)
  92. COM_INTERFACE_ENTRY(IDispatch)
  93. COM_INTERFACE_ENTRY(ICheckError)
  94. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  95. END_COM_MAP()
  96. DECLARE_NOT_AGGREGATABLE(CCheckError)
  97. // ISupportsErrorInfo
  98. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  99. // ICheckError
  100. STDMETHOD(get_Id)(/*[out, retval]*/ long *plId);
  101. STDMETHOD(get_Severity)(/*[out, retval]*/ long *plSeverity);
  102. STDMETHOD(get_Description)(/*[out, retval]*/ BSTR *pbstrDescription);
  103. STDMETHOD(get_Key)(/*[out, retval]*/ BSTR *pbstrKey);
  104. STDMETHOD(get_Property)(/*[out, retval]*/ long *plProperty);
  105. // No Interface
  106. CComObject<CCheckError> *GetNextError() {
  107. ASSERT_NULL_OR_POINTER(m_pNextError, CComObject<CCheckError>);
  108. return m_pNextError;
  109. }
  110. void SetNextError(CComObject<CCheckError> *pNextError) {
  111. ASSERT_NULL_OR_POINTER(pNextError, CComObject<CCheckError>);
  112. m_pNextError = pNextError;
  113. }
  114. private:
  115. long m_lId;
  116. long m_lSeverity;
  117. LPTSTR m_tszDescription;
  118. LPTSTR m_tszKey;
  119. long m_lProperty;
  120. CComObject<CCheckError> *m_pNextError;
  121. };
  122. #endif // !defined(AFX_CHKERROR_H__A4FA4E13_EF45_11D0_9E65_00C04FB94FEF__INCLUDED_)