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.

149 lines
3.0 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. WMIParser_Property.cpp
  5. Abstract:
  6. This file contains the implementation of the WMIParser::Property class,
  7. which is used to hold the data of an property inside a CIM schema.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 07/25/99
  10. created
  11. ******************************************************************************/
  12. #include "stdafx.h"
  13. #define ATTRIBUTE_NAME L"NAME"
  14. #define ATTRIBUTE_TYPE L"TYPE"
  15. WMIParser::Property::Property()
  16. {
  17. __HCP_FUNC_ENTRY( "WMIParser::Property::Property" );
  18. // MPC::XmlUtil m_xmlNode;
  19. // MPC::wstring m_szName;
  20. // MPC::wstring m_szType;
  21. }
  22. WMIParser::Property::~Property()
  23. {
  24. __HCP_FUNC_ENTRY( "WMIParser::Property::~Property" );
  25. }
  26. ////////////////////////////////////////////////
  27. bool WMIParser::Property::operator==( /*[in]*/ LPCWSTR strName ) const
  28. {
  29. __HCP_FUNC_ENTRY( "WMIParser::Property::operator==" );
  30. MPC::NocaseCompare cmp;
  31. bool fRes;
  32. fRes = cmp( m_szName, strName);
  33. __HCP_FUNC_EXIT(fRes);
  34. }
  35. bool WMIParser::Property::operator==( /*[in]*/ const MPC::wstring& szName ) const
  36. {
  37. __HCP_FUNC_ENTRY( "WMIParser::Property::operator==" );
  38. bool fRes;
  39. fRes = (*this == szName.c_str());
  40. __HCP_FUNC_EXIT(fRes);
  41. }
  42. ////////////////////////////////////////////////
  43. HRESULT WMIParser::Property::put_Node( /*[in]*/ IXMLDOMNode* pxdnNode )
  44. {
  45. __HCP_FUNC_ENTRY( "WMIParser::Property::put_Node" );
  46. HRESULT hr;
  47. bool fFound;
  48. __MPC_PARAMCHECK_BEGIN(hr)
  49. __MPC_PARAMCHECK_NOTNULL(pxdnNode);
  50. __MPC_PARAMCHECK_END();
  51. m_xmlNode = pxdnNode;
  52. //
  53. // Analize the node...
  54. //
  55. __MPC_EXIT_IF_METHOD_FAILS(hr, m_xmlNode.GetAttribute( NULL, ATTRIBUTE_NAME, m_szName , fFound ));
  56. __MPC_EXIT_IF_METHOD_FAILS(hr, m_xmlNode.GetAttribute( NULL, ATTRIBUTE_TYPE, m_szType , fFound ));
  57. hr = S_OK;
  58. __HCP_FUNC_CLEANUP;
  59. __HCP_FUNC_EXIT(hr);
  60. }
  61. HRESULT WMIParser::Property::get_Node( /*[out]*/ IXMLDOMNode* *pxdnNode )
  62. {
  63. __HCP_FUNC_ENTRY( "WMIParser::Property::get_Node" );
  64. HRESULT hr;
  65. __MPC_PARAMCHECK_BEGIN(hr)
  66. __MPC_PARAMCHECK_POINTER_AND_SET(pxdnNode,NULL);
  67. __MPC_PARAMCHECK_END();
  68. __MPC_EXIT_IF_METHOD_FAILS(hr, m_xmlNode.GetRoot( pxdnNode ));
  69. hr = S_OK;
  70. __HCP_FUNC_CLEANUP;
  71. __HCP_FUNC_EXIT(hr);
  72. }
  73. ////////////////////////////////////////////////
  74. HRESULT WMIParser::Property::get_Name( /*[out]*/ MPC::wstring& szName )
  75. {
  76. __HCP_FUNC_ENTRY( "WMIParser::Property::get_Name" );
  77. HRESULT hr;
  78. szName = m_szName;
  79. hr = S_OK;
  80. __HCP_FUNC_EXIT(hr);
  81. }
  82. HRESULT WMIParser::Property::get_Type( /*[out]*/ MPC::wstring& szType )
  83. {
  84. __HCP_FUNC_ENTRY( "WMIParser::Property::get_Type" );
  85. HRESULT hr;
  86. szType = m_szType;
  87. hr = S_OK;
  88. __HCP_FUNC_EXIT(hr);
  89. }