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.

205 lines
6.0 KiB

  1. //+------------------------------------------------------------
  2. //
  3. // Copyright (C) 1998, Microsoft Corporation
  4. //
  5. // File: icatprops.h
  6. //
  7. // Contents: Implementation of ICategorizerProperties
  8. //
  9. // Classes: CCategorizerItemIMP
  10. //
  11. // Functions:
  12. //
  13. // History:
  14. // jstamerj 1998/11/11 18:50:28: Created
  15. //
  16. //-------------------------------------------------------------
  17. #ifndef __ICATPROPS_H__
  18. #define __ICATPROPS_H__
  19. #include <windows.h>
  20. #include <dbgtrace.h>
  21. #include <smtpevent.h>
  22. #define CICATEGORIZERPROPSIMP_SIGNATURE (DWORD)'ICPR'
  23. #define CICATEGORIZERPROPSIMP_SIGNATURE_FREE (DWORD)'XCPR'
  24. class CICategorizerPropertiesIMP :
  25. public ICategorizerProperties
  26. {
  27. public:
  28. //IUnknown
  29. STDMETHOD (QueryInterface) (REFIID iid, LPVOID *ppv) {
  30. return m_pIUnknown->QueryInterface(iid, ppv);
  31. }
  32. STDMETHOD_(ULONG, AddRef) () { return m_pIUnknown->AddRef(); }
  33. STDMETHOD_(ULONG, Release) () { return m_pIUnknown->Release(); }
  34. public:
  35. //ICategorizerProperties
  36. STDMETHOD (GetStringA) (
  37. DWORD dwPropId,
  38. DWORD cch,
  39. LPSTR pszValue);
  40. STDMETHOD (PutStringA) (
  41. DWORD dwPropId,
  42. LPSTR pszValue);
  43. STDMETHOD (GetDWORD) (
  44. DWORD dwPropId,
  45. DWORD *pdwValue);
  46. STDMETHOD (PutDWORD) (
  47. DWORD dwPropId,
  48. DWORD dwValue);
  49. STDMETHOD (GetHRESULT) (
  50. DWORD dwPropId,
  51. HRESULT *phrValue);
  52. STDMETHOD (PutHRESULT) (
  53. DWORD dwPropId,
  54. HRESULT hrValue);
  55. STDMETHOD (GetBool) (
  56. DWORD dwPropId,
  57. BOOL *pfValue);
  58. STDMETHOD (PutBool) (
  59. DWORD dwPropId,
  60. BOOL fValue);
  61. STDMETHOD (GetPVoid) (
  62. DWORD dwPropId,
  63. PVOID *ppv);
  64. STDMETHOD (PutPVoid) (
  65. DWORD dwPropId,
  66. PVOID pvValue);
  67. STDMETHOD (GetIUnknown) (
  68. DWORD dwPropId,
  69. IUnknown **ppUnknown);
  70. STDMETHOD (PutIUnknown) (
  71. DWORD dwPropId,
  72. IUnknown *pUnknown);
  73. STDMETHOD (GetIMailMsgProperties) (
  74. DWORD dwPropId,
  75. IMailMsgProperties **ppIMailMsgProperties);
  76. STDMETHOD (PutIMailMsgProperties) (
  77. DWORD dwPropId,
  78. IMailMsgProperties *ppIMailMsgProperties);
  79. STDMETHOD (GetIMailMsgRecipientsAdd) (
  80. DWORD dwPropId,
  81. IMailMsgRecipientsAdd **ppIMsgRecipientsAdd);
  82. STDMETHOD (PutIMailMsgRecipientsAdd) (
  83. DWORD dwPropId,
  84. IMailMsgRecipientsAdd *pIMsgRecipientsAdd);
  85. STDMETHOD (GetICategorizerItemAttributes) (
  86. DWORD dwPropId,
  87. ICategorizerItemAttributes **ppICategorizerItemAttributes);
  88. STDMETHOD (PutICategorizerItemAttributes) (
  89. DWORD dwPropId,
  90. ICategorizerItemAttributes *pICategorizerItemAttributes);
  91. STDMETHOD (GetICategorizerListResolve) (
  92. DWORD dwPropId,
  93. ICategorizerListResolve **ppICategorizerListResolve);
  94. STDMETHOD (PutICategorizerListResolve) (
  95. DWORD dwPropId,
  96. ICategorizerListResolve *pICategorizerListResolve);
  97. STDMETHOD (GetICategorizerMailMsgs) (
  98. DWORD dwPropId,
  99. ICategorizerMailMsgs **ppICategorizerMailMsgs);
  100. STDMETHOD (PutICategorizerMailMsgs) (
  101. DWORD dwPropId,
  102. ICategorizerMailMsgs *pICategorizerMailMsgs);
  103. STDMETHOD (GetICategorizerItem) (
  104. DWORD dwPropId,
  105. ICategorizerItem **ppICategorizerItem);
  106. STDMETHOD (PutICategorizerItem) (
  107. DWORD dwPropId,
  108. ICategorizerItem *pICategorizerItem);
  109. STDMETHOD (UnSetPropId) (
  110. DWORD dwPropId);
  111. public:
  112. DWORD NumProps() {return m_dwNumPropIds;}
  113. HRESULT GetStringAPtr(
  114. DWORD dwPropId,
  115. LPSTR *ppsz);
  116. private:
  117. CICategorizerPropertiesIMP(IUnknown *pIUnknown);
  118. virtual ~CICategorizerPropertiesIMP();
  119. void * operator new(size_t size, DWORD dwNumProps);
  120. HRESULT Initialize();
  121. LPSTR m_strdup(LPSTR psz);
  122. typedef enum _PropStatus {
  123. PROPSTATUS_UNSET = 0,
  124. PROPSTATUS_SET_DWORD,
  125. PROPSTATUS_SET_HRESULT,
  126. PROPSTATUS_SET_BOOL,
  127. PROPSTATUS_SET_PVOID,
  128. PROPSTATUS_SET_STRINGA,
  129. PROPSTATUS_SET_IUNKNOWN,
  130. PROPSTATUS_SET_IMAILMSGPROPERTIES,
  131. PROPSTATUS_SET_IMAILMSGRECIPIENTSADD,
  132. PROPSTATUS_SET_ICATEGORIZERITEMATTRIBUTES,
  133. PROPSTATUS_SET_ICATEGORIZERLISTRESOLVE,
  134. PROPSTATUS_SET_ICATEGORIZERMAILMSGS,
  135. PROPSTATUS_SET_ICATEGORIZERITEM
  136. } PROPSTATUS, *PPROPSTATUS;
  137. typedef struct _tagProp {
  138. PROPSTATUS PropStatus;
  139. union _tag_PropValue {
  140. LPSTR pszValue;
  141. DWORD dwValue;
  142. BOOL fValue;
  143. PVOID pvValue;
  144. IUnknown *pIUnknownValue;
  145. IMailMsgProperties *pIMailMsgPropertiesValue;
  146. IMailMsgRecipientsAdd *pIMailMsgRecipientsAddValue;
  147. ICategorizerItemAttributes *pICategorizerItemAttributesValue;
  148. ICategorizerListResolve *pICategorizerListResolveValue;
  149. ICategorizerMailMsgs *pICategorizerMailMsgsValue;
  150. ICategorizerItem *pICategorizerItemValue;
  151. } PropValue;
  152. } PROPERTY, *PPROPERTY;
  153. DWORD m_dwSignature;
  154. IUnknown *m_pIUnknown;
  155. DWORD m_dwNumPropIds;
  156. PPROPERTY m_rgProperties;
  157. friend class CCategorizer;
  158. friend class CICategorizerItemIMP;
  159. friend class CICategorizerListResolveIMP;
  160. friend class CICategorizerDLListResolveIMP;
  161. };
  162. //+------------------------------------------------------------
  163. //
  164. // Function: CICategorizerPropertiesIMP::m_strdup
  165. //
  166. // Synopsis: Allocates and copies a string
  167. //
  168. // Arguments:
  169. // psz: String to copy
  170. //
  171. // Returns:
  172. // Address of allocated string buffer, or NULL if out of memory
  173. //
  174. // History:
  175. // jstamerj 1998/06/20 19:07:12: Created.
  176. //
  177. //-------------------------------------------------------------
  178. inline LPSTR CICategorizerPropertiesIMP::m_strdup(
  179. LPSTR psz)
  180. {
  181. _ASSERT(psz);
  182. LPSTR pszNew;
  183. pszNew = new CHAR[lstrlen(psz)+1];
  184. if(pszNew) {
  185. lstrcpy(pszNew, psz);
  186. }
  187. return pszNew;
  188. }
  189. #endif //__ICATPROPS_H__