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.

168 lines
5.2 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. QueryResult.h
  5. Abstract:
  6. This file contains the declaration of the classes used to store
  7. results from queries to the database.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 07/26/99
  10. created
  11. ******************************************************************************/
  12. #if !defined(__INCLUDED___PCH___QUERYRESULT_H___)
  13. #define __INCLUDED___PCH___QUERYRESULT_H___
  14. //
  15. // From HelpServiceTypeLib.idl
  16. //
  17. #include <HelpServiceTypeLib.h>
  18. #include <MPC_streams.h>
  19. ////////////////////////////////////////////////////////////////////////////////
  20. typedef MPC::CComCollection< IPCHCollection, &LIBID_HelpServiceTypeLib, MPC::CComSafeMultiThreadModel> CPCHBaseCollection;
  21. class ATL_NO_VTABLE CPCHCollection : // Hungarian: hcpc
  22. public CPCHBaseCollection
  23. {
  24. public:
  25. BEGIN_COM_MAP(CPCHCollection)
  26. COM_INTERFACE_ENTRY(IDispatch)
  27. COM_INTERFACE_ENTRY(IPCHCollection)
  28. END_COM_MAP()
  29. };
  30. /////////////////////////////////////////////////////////////////////////////
  31. class ATL_NO_VTABLE CPCHQueryResult : // Hungarian: hcpqr
  32. public CComObjectRootEx<MPC::CComSafeMultiThreadModel>,
  33. public IDispatchImpl< IPCHQueryResult, &IID_IPCHQueryResult, &LIBID_HelpServiceTypeLib >
  34. {
  35. public:
  36. struct Payload
  37. {
  38. CComBSTR m_bstrCategory;
  39. CComBSTR m_bstrEntry;
  40. CComBSTR m_bstrTopicURL;
  41. CComBSTR m_bstrIconURL;
  42. CComBSTR m_bstrTitle;
  43. CComBSTR m_bstrDescription;
  44. long m_lType;
  45. long m_lPos;
  46. bool m_fVisible;
  47. bool m_fSubsite;
  48. long m_lNavModel;
  49. long m_lPriority;
  50. Payload();
  51. };
  52. private:
  53. Payload m_data;
  54. public:
  55. DECLARE_PROTECT_FINAL_CONSTRUCT()
  56. BEGIN_COM_MAP(CPCHQueryResult)
  57. COM_INTERFACE_ENTRY(IDispatch)
  58. COM_INTERFACE_ENTRY(IPCHQueryResult)
  59. END_COM_MAP()
  60. CPCHQueryResult();
  61. HRESULT Load( /*[in]*/ MPC::Serializer& streamIn );
  62. HRESULT Save( /*[in]*/ MPC::Serializer& streamOut ) const;
  63. void Initialize( /*[in]*/ Payload& data );
  64. const Payload& GetData() { return m_data; }
  65. public:
  66. //
  67. // IPCHQueryResult
  68. //
  69. STDMETHOD(get_Category )( /*[out]*/ BSTR *pVal );
  70. STDMETHOD(get_Entry )( /*[out]*/ BSTR *pVal );
  71. STDMETHOD(get_TopicURL )( /*[out]*/ BSTR *pVal );
  72. STDMETHOD(get_IconURL )( /*[out]*/ BSTR *pVal );
  73. STDMETHOD(get_Title )( /*[out]*/ BSTR *pVal );
  74. STDMETHOD(get_Description )( /*[out]*/ BSTR *pVal );
  75. STDMETHOD(get_Type )( /*[out]*/ long *pVal );
  76. STDMETHOD(get_Pos )( /*[out]*/ long *pVal );
  77. STDMETHOD(get_Visible )( /*[out]*/ VARIANT_BOOL *pVal );
  78. STDMETHOD(get_Subsite )( /*[out]*/ VARIANT_BOOL *pVal );
  79. STDMETHOD(get_NavigationModel)( /*[out]*/ QR_NAVMODEL *pVal );
  80. STDMETHOD(get_Priority )( /*[out]*/ long *pVal );
  81. STDMETHOD(get_FullPath )( /*[out]*/ BSTR *pVal );
  82. };
  83. /////////////////////////////////////////////////////////////////////////////
  84. class ATL_NO_VTABLE CPCHQueryResultCollection :
  85. public CPCHBaseCollection,
  86. public IPersistStream
  87. {
  88. typedef std::list< CPCHQueryResult* > List;
  89. typedef List::iterator Iter;
  90. typedef List::const_iterator IterConst;
  91. List m_results;
  92. public:
  93. BEGIN_COM_MAP(CPCHQueryResultCollection)
  94. COM_INTERFACE_ENTRY(IDispatch)
  95. COM_INTERFACE_ENTRY(IPCHCollection)
  96. COM_INTERFACE_ENTRY(IPersistStream)
  97. END_COM_MAP()
  98. CPCHQueryResultCollection();
  99. ~CPCHQueryResultCollection();
  100. static HRESULT MakeLocalCopyIfPossible( /*[in]*/ IPCHCollection* pRemote, /*[out]*/ IPCHCollection* *pLocal );
  101. typedef enum
  102. {
  103. SORT_BYCONTENTTYPE,
  104. SORT_BYPRIORITY ,
  105. SORT_BYURL ,
  106. SORT_BYTITLE ,
  107. } SortMode;
  108. ////////////////////////////////////////
  109. //
  110. // IPersist
  111. //
  112. STDMETHOD(GetClassID)( /*[out]*/ CLSID *pClassID );
  113. //
  114. // IPersistStream
  115. //
  116. STDMETHOD(IsDirty)();
  117. STDMETHOD(Load)( /*[in]*/ IStream *pStm );
  118. STDMETHOD(Save)( /*[in]*/ IStream *pStm, /*[in]*/ BOOL fClearDirty );
  119. STDMETHOD(GetSizeMax)( /*[out]*/ ULARGE_INTEGER *pcbSize );
  120. //
  121. ////////////////////////////////////////
  122. int Size ( ) const;
  123. void Erase( );
  124. HRESULT Load ( /*[in]*/ MPC::Serializer& streamIn );
  125. HRESULT Save ( /*[in]*/ MPC::Serializer& streamOut ) const;
  126. HRESULT CreateItem( /*[out]*/ CPCHQueryResult* *item );
  127. HRESULT GetItem ( /*[in]*/ long lPos, /*[out]*/ CPCHQueryResult* *item );
  128. HRESULT LoadFromCache( /*[in]*/ IStream* stream );
  129. HRESULT SaveToCache ( /*[in]*/ IStream* stream ) const;
  130. HRESULT Sort( /*[in]*/ SortMode mode, /*[in]*/ int iLimit = -1 );
  131. };
  132. #endif // !defined(__INCLUDED___PCH___QUERYRESULT_H___)