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.

203 lines
7.3 KiB

  1. /********************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. ParamConfig.h
  5. Abstract:
  6. Implements the class CParamList that contains methods for traversing the elements
  7. of XML file that contains the parameters required by the search engine. A sample parameter list
  8. (also known as config file) XML file if shown here -
  9. <?xml version="1.0" encoding="UTF-8"?>
  10. <PARAM_LIST
  11. SERVER_URL = "http://gsadevnet/GSASearch/search.asmx/Search"
  12. REMOTECONFIG_SERVER_URL = "http://gsadevnet/GSASearch/search.asmx/"
  13. UPDATE_FREQUENCY = "3">
  14. <PARAM_ITEM NAME="ProdID" TYPE="PARAM_LIST">
  15. <DESCRIPTION>Choose one of the following products:</DESCRIPTION>
  16. <PARAM_VALUE VALUE="enable">
  17. <DISPLAYSTRING>Accessibility</DISPLAYSTRING>
  18. </PARAM_VALUE>
  19. <PARAM_VALUE VALUE="drx" DEFAULT="true">
  20. <DISPLAYSTRING>DirectX (Home User)</DISPLAYSTRING>
  21. </PARAM_VALUE>
  22. </PARAM_ITEM>
  23. </PARAM_LIST>
  24. Revision History:
  25. a-prakac created 12/05/2000
  26. ********************************************************************/
  27. #if !defined(__INCLUDED___PCH___SELIB_PARAMCONFIG_H___)
  28. #define __INCLUDED___PCH___SELIB_PARAMCONFIG_H___
  29. #include <SearchEngineLib.h>
  30. #include <MPC_config.h>
  31. class CParamList :
  32. public MPC::Config::TypeConstructor,
  33. public MPC::NamedMutex
  34. {
  35. class CParamValue : public MPC::Config::TypeConstructor
  36. {
  37. DECLARE_CONFIG_MAP(CParamValue);
  38. public:
  39. //
  40. // m_bstrValue - The value to be passed to the wrapper when
  41. // this item is selected (used in case of PARAM_LIST)
  42. // m_bstrDisplayString - The display string that needs to be displayed
  43. // on UI (used in case of PARAM_LIST)
  44. // m _bDefault - Bool value that denotes if this is the default value to shown
  45. // in the case PARAM_LIST. This value will show up first in the drop down list.
  46. //
  47. CComBSTR m_bstrValue;
  48. CComBSTR m_bstrDisplayString;
  49. bool m_bDefault;
  50. ////////////////////////////////////////
  51. //
  52. // MPC::Config::TypeConstructor
  53. //
  54. DEFINE_CONFIG_DEFAULTTAG();
  55. DECLARE_CONFIG_METHODS();
  56. //
  57. ////////////////////////////////////////
  58. };
  59. typedef std::list< CParamValue > ParamValue;
  60. typedef ParamValue::iterator ParamValueIter;
  61. typedef ParamValue::const_iterator ParamValueIterConst;
  62. class CParamItem : public MPC::Config::TypeConstructor
  63. {
  64. DECLARE_CONFIG_MAP(CParamItem);
  65. public:
  66. //
  67. // m_bstrName - Name of the parameter - for ex, "ProdID"
  68. // m_bstrType - Type of the parameter - for ex, "PARAM_LIST"
  69. // m_bstrDescription - Description that is to be shown on UI - for ex, "Please select a product"
  70. // m_bRequired - Whether this parameter is required or not
  71. // m_bVisible - Whether this parameter is visible or not
  72. //
  73. CComBSTR m_bstrName;
  74. CComBSTR m_bstrType;
  75. CComBSTR m_bstrDescription;
  76. bool m_bRequired;
  77. bool m_bVisible;
  78. ParamValue m_lstParamValue;
  79. CComBSTR m_bstrXML;
  80. ////////////////////////////////////////
  81. //
  82. // MPC::Config::TypeConstructor
  83. //
  84. DEFINE_CONFIG_DEFAULTTAG();
  85. DECLARE_CONFIG_METHODS();
  86. //
  87. ////////////////////////////////////////
  88. bool FindDefaultValue( /*[out]*/ ParamValueIter& it );
  89. };
  90. typedef std::list< CParamItem > ParamItem;
  91. typedef ParamItem::iterator ParamItemIter;
  92. typedef ParamItem::const_iterator ParamItemIterConst;
  93. ////////////////////////////////////////
  94. DECLARE_CONFIG_MAP(CParamList);
  95. //
  96. // Attributes of the PARAM_LIST tag in the schema
  97. //
  98. // m_bstrServerURL - This is the server url used for querying
  99. // m_lUpdateFrequency - This is the frequency (in number of days) that the NetSearch wrapper
  100. // should make an attempt to download the latest copy of the config file
  101. // m_bstrErrorInfo - Error info passed by the server if unable to send the
  102. // updated version
  103. // m_bError - Bool value that denotes if an error occured or not
  104. // m_bRemoteServerUrlPresent - This is the URL of the server that sends the updated parameter list
  105. // m_bstrRemoteConfigServerURL - Bool value that dentoes whether the above remote server URL is
  106. // present or not
  107. //
  108. CComBSTR m_bstrServerURL;
  109. long m_lUpdateFrequency;
  110. CComBSTR m_bstrErrorInfo;
  111. bool m_bError;
  112. bool m_bRemoteServerUrlPresent;
  113. CComBSTR m_bstrRemoteConfigServerURL;
  114. CComBSTR m_bstrSearchEngineName;
  115. CComBSTR m_bstrSearchEngineDescription;
  116. CComBSTR m_bstrSearchEngineOwner;
  117. bool m_bStandardSearch;
  118. bool m_bSearchTypePresent;
  119. //
  120. // Private variables that do not map to attributes/elements in the schema
  121. //
  122. CComBSTR m_bstrConfigFilePath;
  123. ParamItem m_lstParamItem;
  124. ParamItemIter m_itCurrentParam;
  125. ////////////////////////////////////////
  126. //
  127. // MPC::Config::TypeConstructor
  128. //
  129. DEFINE_CONFIG_DEFAULTTAG();
  130. DECLARE_CONFIG_METHODS ();
  131. //
  132. ////////////////////////////////////////
  133. private:
  134. HRESULT get_Type( /*[in]*/ BSTR bstrType, /*[out]*/ ParamTypeEnum& enmParamType );
  135. public:
  136. CParamList ();
  137. ~CParamList ();
  138. HRESULT MoveNext ();
  139. HRESULT MoveFirst ();
  140. HRESULT ClearResults ();
  141. bool IsCursorValid();
  142. bool RemoteConfig ();
  143. HRESULT Load( /*[in]*/ BSTR bstrLCID, /*[in]*/ BSTR bstrID, /*[in]*/ BSTR bstrXMLConfigData );
  144. HRESULT get_Name ( /*[out]*/ CComBSTR& bstrName );
  145. HRESULT get_ConfigFilePath ( /*[out]*/ CComBSTR& bstrPath );
  146. HRESULT get_SearchEngineName ( /*[out]*/ CComBSTR& bstrSEName );
  147. HRESULT get_SearchEngineDescription( /*[out]*/ CComBSTR& bstrSEDescription );
  148. HRESULT get_SearchEngineOwner ( /*[out]*/ CComBSTR& bstrSEOwner );
  149. HRESULT get_ServerUrl ( /*[out]*/ CComBSTR& bstrServerUrl );
  150. HRESULT get_UpdateFrequency ( /*[out]*/ long& lUpdateFrequency );
  151. HRESULT get_RemoteServerUrl ( /*[out]*/ CComBSTR& bstrRemoteServerURL );
  152. HRESULT InitializeParamObject( /*[out]*/ SearchEngine::ParamItem_Definition2& def );
  153. HRESULT GetDefaultValue ( /*[in]*/ BSTR bstrParamName, /*[in,out]*/ MPC::wstring& strValue );
  154. bool IsStandardSearch ();
  155. ////////////////////////////////////////
  156. };
  157. #endif // !defined(__INCLUDED___PCH___SELIB_PARAMCONFIG_H___)