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.

125 lines
3.6 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. InstanceBase.cpp
  5. Abstract:
  6. This file contains the implementation of the Taxonomy::InstanceBase class,
  7. which controls the set of files for a specific SKU.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 24/03/2001
  10. created
  11. ******************************************************************************/
  12. #include "stdafx.h"
  13. ////////////////////////////////////////////////////////////////////////////////
  14. Taxonomy::InstanceBase::InstanceBase()
  15. {
  16. // Taxonomy::HelpSet m_ths;
  17. // MPC::wstring m_strDisplayName;
  18. // MPC::wstring m_strProductID;
  19. // MPC::wstring m_strVersion;
  20. //
  21. m_fDesktop = false; // bool m_fDesktop;
  22. m_fServer = false; // bool m_fServer;
  23. m_fEmbedded = false; // bool m_fEmbedded;
  24. }
  25. HRESULT Taxonomy::operator>>( /*[in]*/ MPC::Serializer& stream, /*[out]*/ Taxonomy::InstanceBase& val )
  26. {
  27. HRESULT hr;
  28. if(SUCCEEDED(hr = (stream >> val.m_ths )) &&
  29. SUCCEEDED(hr = (stream >> val.m_strDisplayName)) &&
  30. SUCCEEDED(hr = (stream >> val.m_strProductID )) &&
  31. SUCCEEDED(hr = (stream >> val.m_strVersion )) &&
  32. SUCCEEDED(hr = (stream >> val.m_fDesktop )) &&
  33. SUCCEEDED(hr = (stream >> val.m_fServer )) &&
  34. SUCCEEDED(hr = (stream >> val.m_fEmbedded )) )
  35. {
  36. hr = S_OK;
  37. }
  38. return hr;
  39. }
  40. HRESULT Taxonomy::operator<<( /*[in]*/ MPC::Serializer& stream, /*[in] */ const Taxonomy::InstanceBase& val )
  41. {
  42. HRESULT hr;
  43. if(SUCCEEDED(hr = (stream << val.m_ths )) &&
  44. SUCCEEDED(hr = (stream << val.m_strDisplayName)) &&
  45. SUCCEEDED(hr = (stream << val.m_strProductID )) &&
  46. SUCCEEDED(hr = (stream << val.m_strVersion )) &&
  47. SUCCEEDED(hr = (stream << val.m_fDesktop )) &&
  48. SUCCEEDED(hr = (stream << val.m_fServer )) &&
  49. SUCCEEDED(hr = (stream << val.m_fEmbedded )) )
  50. {
  51. hr = S_OK;
  52. }
  53. return hr;
  54. }
  55. ////////////////////////////////////////////////////////////////////////////////
  56. bool Taxonomy::InstanceBase::Match( /*[in]*/ LPCWSTR szSKU ,
  57. /*[in]*/ LPCWSTR szLanguage )
  58. {
  59. while(1)
  60. {
  61. if(STRINGISPRESENT(szSKU))
  62. {
  63. if(!_wcsicmp( szSKU, L"All" ))
  64. {
  65. ;
  66. }
  67. else if(!_wcsicmp( szSKU, L"Server" ))
  68. {
  69. if(m_fServer == false) break;
  70. }
  71. else if(!_wcsicmp( szSKU, L"Desktop" ))
  72. {
  73. if(m_fDesktop == false) break;
  74. }
  75. else if(!_wcsicmp( szSKU, L"Embedded" ))
  76. {
  77. if(m_fEmbedded == false) break;
  78. }
  79. else
  80. {
  81. if(_wcsicmp( szSKU, m_ths.GetSKU() ) != 0) break;
  82. }
  83. }
  84. if(STRINGISPRESENT(szLanguage))
  85. {
  86. if(!_wcsicmp( szLanguage, L"All" ))
  87. {
  88. ;
  89. }
  90. else
  91. {
  92. if(_wtol( szLanguage ) != m_ths.GetLanguage()) break;
  93. }
  94. }
  95. return true;
  96. }
  97. return false;
  98. }
  99. bool Taxonomy::InstanceBase::Match( /*[in]*/ const Package& pkg )
  100. {
  101. return Match( pkg.m_strSKU.c_str(), pkg.m_strLanguage.c_str() );
  102. }