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.

223 lines
6.7 KiB

  1. #ifndef _SCHEMACLASSES_H_
  2. #define _SCHEMACLASSES_H_
  3. //#include "csyntax.h"
  4. class COleDsSyntax;
  5. class CMainDoc;
  6. typedef enum _tagCLASSATTR
  7. {
  8. ca_ERROR=0,
  9. ca_Name,
  10. ca_DisplayName,
  11. ca_CLSID,
  12. ca_PrimaryInterface,
  13. ca_OID,
  14. ca_Abstract,
  15. ca_DerivedFrom,
  16. ca_Containment,
  17. ca_Container,
  18. ca_HelpFileName,
  19. ca_HelpFileContext,
  20. ca_MethodsCount,
  21. ca_Limit
  22. } CLASSATTR;
  23. typedef enum _tagFUNCSETATTR
  24. {
  25. fa_ERROR=0,
  26. fa_Name,
  27. fa_DisplayName,
  28. fa_Limit
  29. } FUNCSETATTR;
  30. typedef enum _tagMETHODATTR
  31. {
  32. ma_ERROR=0,
  33. ma_Name,
  34. ma_DisplayName,
  35. ma_Limit
  36. } METHODATTR;
  37. typedef enum _tagPROPATTR
  38. {
  39. pa_ERROR=0,
  40. pa_Name,
  41. pa_DisplayName,
  42. pa_Type,
  43. pa_DsNames,
  44. pa_OID,
  45. pa_MaxRange,
  46. pa_MinRange,
  47. pa_Mandatory,
  48. pa_MultiValued,
  49. pa_Limit
  50. } PROPATTR;
  51. class CMethod: public CObject
  52. {
  53. public:
  54. CMethod( );
  55. CMethod( ITypeInfo*, FUNCDESC* );
  56. ~CMethod( );
  57. CString GetName( );
  58. int GetArgCount( );
  59. int GetArgOptionalCount( );
  60. VARTYPE GetMethodReturnType( );
  61. BOOL ConvertArgument( int nArg, CString strArg, VARIANT* );
  62. HRESULT CallMethod ( IDispatch* pIDispatch, BOOL* pDisplay );
  63. CString GetAttribute ( METHODATTR );
  64. HRESULT PutAttribute ( METHODATTR, CString& );
  65. private:
  66. int m_nArgs;
  67. int m_nArgsOpt;
  68. CString m_strName;
  69. VARTYPE* m_pArgTypes;
  70. VARTYPE m_ReturnType;
  71. CStringArray m_strArgNames;
  72. CString m_strAttributes[ ma_Limit ];
  73. };
  74. class CProperty: public CObject
  75. {
  76. public:
  77. CProperty ( IADs* );
  78. CProperty ( );
  79. ~CProperty ( );
  80. CProperty ( TCHAR* pszName, TCHAR* pszSyntax, BOOL bMultiValued = FALSE );
  81. //methods
  82. CString VarToDisplayString( VARIANT&, BOOL bUseEx );
  83. BOOL DisplayStringToDispParams( CString&, DISPPARAMS&, BOOL bEx );
  84. BOOL SetMandatory ( BOOL );
  85. BOOL GetMandatory ( );
  86. CString GetAttribute ( PROPATTR );
  87. HRESULT PutAttribute ( PROPATTR, CString& );
  88. BOOL SetSyntaxID ( DWORD );
  89. DWORD GetSyntaxID ( );
  90. HRESULT Native2Value ( ADS_ATTR_INFO*, CString& );
  91. HRESULT Value2Native ( ADS_ATTR_INFO*, CString& );
  92. void FreeAttrInfo ( ADS_ATTR_INFO* );
  93. protected:
  94. void CreateSyntax( ADSTYPE );
  95. BOOL m_bMandatory;
  96. BOOL m_bMultiValued;
  97. DWORD m_dwSyntaxID;
  98. CString m_strAttributes[ pa_Limit ];
  99. BOOL m_bDefaultSyntax;
  100. COleDsSyntax* m_pSyntax;
  101. };
  102. /*class CFuncSet: public CObject
  103. {
  104. public:
  105. CFuncSet ( CString& );
  106. CFuncSet ( );
  107. ~CFuncSet( );
  108. //methods
  109. BOOL HasMandatoryProperties ( );
  110. void AddProperty ( CProperty* );
  111. int GetPropertyCount ( );
  112. CString GetAttribute ( int, PROPATTR );
  113. HRESULT PutAttribute ( int, PROPATTR, CString& );
  114. CString GetAttribute ( int, METHODATTR );
  115. HRESULT PutAttribute ( int, METHODATTR, CString& );
  116. CString GetAttribute ( FUNCSETATTR );
  117. HRESULT PutAttribute ( FUNCSETATTR, CString& );
  118. CString VarToDisplayString ( int, VARIANT&, BOOL bUseEx );
  119. BOOL DisplayStringToDispParams ( int, CString&, DISPPARAMS&, BOOL bUseEx );
  120. int LookupProperty ( CString& );
  121. CProperty* GetProperty ( int );
  122. CMethod* GetMethod ( int );
  123. HRESULT LoadMethodsInformation ( ITypeInfo* );
  124. protected:
  125. CProperty* GetProperty( CString& );
  126. protected:
  127. CString m_strAttributes[ fa_Limit ];
  128. CObArray* m_pProperties;
  129. CObArray* m_pMethods;
  130. };*/
  131. class CClass: public CObject
  132. {
  133. public:
  134. CClass ( CString&, CMainDoc* pMainDoc );
  135. CClass ( );
  136. ~CClass ( );
  137. CClass ( TCHAR* pszClass, REFIID rPrimaryInterface );
  138. //methods
  139. BOOL HasMandatoryProperties ( void );
  140. void AddProperty ( CProperty* );
  141. //**************
  142. CString GetAttribute ( CLASSATTR );
  143. HRESULT PutAttribute ( CLASSATTR, CString& );
  144. //**************
  145. CString GetAttribute ( int, METHODATTR );
  146. HRESULT PutAttribute ( int, METHODATTR, CString& );
  147. //**************
  148. CString GetAttribute ( int, PROPATTR );
  149. HRESULT PutAttribute ( int, PROPATTR, CString& );
  150. int GetPropertyCount ( void );
  151. int GetMethodsCount ( void );
  152. CMethod* GetMethod ( int );
  153. CProperty* GetProperty ( int );
  154. CString VarToDisplayString ( int, VARIANT&, BOOL bUseEx );
  155. BOOL DisplayStringToDispParams ( int, CString&, DISPPARAMS&, BOOL bUseEx );
  156. BOOL SupportContainer ( void )
  157. { return m_bContainer; };
  158. HRESULT LoadMethodsInformation ( TCHAR* );
  159. HRESULT LoadMethodsInformation ( ITypeInfo* );
  160. int LookupProperty ( CString& );
  161. REFIID GetMethodsInterface ( );
  162. protected:
  163. HRESULT ReadMandatoryPropertiesInformation ( VARIANT* );
  164. HRESULT BuildOptionalPropertiesList ( IADsClass* );
  165. HRESULT BuildOptionalPropertiesList ( IADsContainer* );
  166. HRESULT BuildMandatoryPropertiesList ( IADsClass* );
  167. HRESULT AddProperties ( IADsClass*, VARIANT&, BOOL bMandatory );
  168. HRESULT AddProperty ( BSTR, BSTR, BOOL bMandatory );
  169. CProperty* GetProperty( CString& );
  170. protected:
  171. BOOL m_bContainer;
  172. CString m_strAttributes[ ca_Limit ];
  173. CMainDoc* m_pMainDoc;
  174. REFIID m_refMethods;
  175. public:
  176. CObArray* m_pProperties;
  177. CObArray* m_pMethods;
  178. };
  179. #endif