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.

221 lines
6.8 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. HPCQueryResult.cpp
  5. Abstract:
  6. This file contains the implementation of the CHPCQueryResult class,
  7. the descriptor of all the query results.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 07/26/99
  10. created
  11. ******************************************************************************/
  12. #include "stdafx.h"
  13. CPCHQueryResult::Payload::Payload()
  14. {
  15. // CComBSTR m_bstrCategory;
  16. // CComBSTR m_bstrEntry;
  17. // CComBSTR m_bstrTopicURL;
  18. // CComBSTR m_bstrIconURL;
  19. // CComBSTR m_bstrTitle;
  20. // CComBSTR m_bstrDescription;
  21. m_lType = 0; // long m_lType;
  22. m_lPos = 0; // long m_lPos;
  23. m_fVisible = true; // bool m_fVisible;
  24. m_fSubsite = true; // bool m_fSubsite;
  25. m_lNavModel = QR_DEFAULT; // long m_lNavModel;
  26. m_lPriority = 0; // long m_lPriority;
  27. }
  28. ////////////////////////////////////////////////////////////////////////////////
  29. ////////////////////////////////////////////////////////////////////////////////
  30. CPCHQueryResult::CPCHQueryResult()
  31. {
  32. // Payload m_data;
  33. }
  34. /////////////////////////////////////////////////////////////////////////////
  35. HRESULT CPCHQueryResult::Load( /*[in]*/ MPC::Serializer& streamIn )
  36. {
  37. __HCP_FUNC_ENTRY( "CPCHQueryResult::Load" );
  38. HRESULT hr;
  39. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrCategory );
  40. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrEntry );
  41. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrTopicURL );
  42. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrIconURL );
  43. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrTitle );
  44. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_bstrDescription);
  45. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_lType );
  46. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_lPos );
  47. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_fVisible );
  48. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_fSubsite );
  49. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_lNavModel );
  50. __MPC_EXIT_IF_METHOD_FAILS(hr, streamIn >> m_data.m_lPriority );
  51. hr = S_OK;
  52. __HCP_FUNC_CLEANUP;
  53. __HCP_FUNC_EXIT(hr);
  54. }
  55. HRESULT CPCHQueryResult::Save( /*[in]*/ MPC::Serializer& streamOut ) const
  56. {
  57. __HCP_FUNC_ENTRY( "CPCHQueryResult::Save" );
  58. HRESULT hr;
  59. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrCategory );
  60. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrEntry );
  61. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrTopicURL );
  62. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrIconURL );
  63. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrTitle );
  64. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_bstrDescription);
  65. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_lType );
  66. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_lPos );
  67. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_fVisible );
  68. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_fSubsite );
  69. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_lNavModel );
  70. __MPC_EXIT_IF_METHOD_FAILS(hr, streamOut << m_data.m_lPriority );
  71. hr = S_OK;
  72. __HCP_FUNC_CLEANUP;
  73. __HCP_FUNC_EXIT(hr);
  74. }
  75. void CPCHQueryResult::Initialize( /*[in]*/ Payload& data )
  76. {
  77. m_data = data;
  78. }
  79. /////////////////////////////////////////////////////////////////////////////
  80. STDMETHODIMP CPCHQueryResult::get_Category( /*[out]*/ BSTR *pVal )
  81. {
  82. MPC::SmartLock<_ThreadModel> lock( this );
  83. return MPC::GetBSTR( m_data.m_bstrCategory, pVal );
  84. }
  85. STDMETHODIMP CPCHQueryResult::get_Entry( /*[out]*/ BSTR *pVal )
  86. {
  87. MPC::SmartLock<_ThreadModel> lock( this );
  88. return MPC::GetBSTR( m_data.m_bstrEntry, pVal );
  89. }
  90. STDMETHODIMP CPCHQueryResult::get_TopicURL( /*[out]*/ BSTR *pVal )
  91. {
  92. MPC::SmartLock<_ThreadModel> lock( this );
  93. return MPC::GetBSTR( m_data.m_bstrTopicURL, pVal );
  94. }
  95. STDMETHODIMP CPCHQueryResult::get_IconURL( /*[out]*/ BSTR *pVal )
  96. {
  97. MPC::SmartLock<_ThreadModel> lock( this );
  98. return MPC::GetBSTR( m_data.m_bstrIconURL, pVal );
  99. }
  100. STDMETHODIMP CPCHQueryResult::get_Title( /*[out]*/ BSTR *pVal )
  101. {
  102. MPC::SmartLock<_ThreadModel> lock( this );
  103. return MPC::GetBSTR( m_data.m_bstrTitle, pVal );
  104. }
  105. STDMETHODIMP CPCHQueryResult::get_Description( /*[out]*/ BSTR *pVal )
  106. {
  107. MPC::SmartLock<_ThreadModel> lock( this );
  108. return MPC::GetBSTR( m_data.m_bstrDescription, pVal );
  109. }
  110. STDMETHODIMP CPCHQueryResult::get_Type( /*[out]*/ long *pVal )
  111. {
  112. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_Type",hr,pVal,m_data.m_lType);
  113. __HCP_END_PROPERTY(hr);
  114. }
  115. STDMETHODIMP CPCHQueryResult::get_Pos( /*[out]*/ long *pVal )
  116. {
  117. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_Pos",hr,pVal,m_data.m_lPos);
  118. __HCP_END_PROPERTY(hr);
  119. }
  120. STDMETHODIMP CPCHQueryResult::get_Visible( /*[out]*/ VARIANT_BOOL *pVal )
  121. {
  122. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_Visible",hr,pVal,(m_data.m_fVisible ? VARIANT_TRUE : VARIANT_FALSE));
  123. __HCP_END_PROPERTY(hr);
  124. }
  125. STDMETHODIMP CPCHQueryResult::get_Subsite( /*[out]*/ VARIANT_BOOL *pVal )
  126. {
  127. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_Subsite",hr,pVal,(m_data.m_fSubsite ? VARIANT_TRUE : VARIANT_FALSE));
  128. __HCP_END_PROPERTY(hr);
  129. }
  130. STDMETHODIMP CPCHQueryResult::get_NavigationModel( /*[out]*/ QR_NAVMODEL *pVal )
  131. {
  132. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_NavigationModel",hr,pVal,(QR_NAVMODEL)m_data.m_lNavModel);
  133. __HCP_END_PROPERTY(hr);
  134. }
  135. STDMETHODIMP CPCHQueryResult::get_Priority( /*[out]*/ long *pVal )
  136. {
  137. __HCP_BEGIN_PROPERTY_GET2("CPCHQueryResult::get_Priority",hr,pVal,m_data.m_lPriority);
  138. __HCP_END_PROPERTY(hr);
  139. }
  140. STDMETHODIMP CPCHQueryResult::get_FullPath( /*[out]*/ BSTR *pVal )
  141. {
  142. MPC::SmartLock<_ThreadModel> lock( this );
  143. MPC::wstring strFullPath; strFullPath.reserve( 512 );
  144. if(STRINGISPRESENT(m_data.m_bstrCategory))
  145. {
  146. strFullPath += m_data.m_bstrCategory;
  147. if(STRINGISPRESENT(m_data.m_bstrEntry))
  148. {
  149. strFullPath += L"/";
  150. strFullPath += m_data.m_bstrEntry;
  151. }
  152. }
  153. else if(STRINGISPRESENT(m_data.m_bstrEntry))
  154. {
  155. strFullPath += m_data.m_bstrEntry;
  156. }
  157. return MPC::GetBSTR( strFullPath.c_str(), pVal );
  158. }