Source code of Windows XP (NT5)
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.

85 lines
1.9 KiB

  1. // GuideDataProvider.cpp : Implementation of CGuideDataProvider
  2. #include "stdafx.h"
  3. #include "GuideDataProvider.h"
  4. /////////////////////////////////////////////////////////////////////////////
  5. // CGuideDataProvider
  6. STDMETHODIMP CGuideDataProvider::get_Name(BSTR *pbstrName)
  7. {
  8. ENTER_API
  9. {
  10. ValidateOut(pbstrName);
  11. return m_pdb->DescriptionPropSet::_get_Name((IGuideDataProvider *) this, pbstrName);
  12. }
  13. LEAVE_API
  14. }
  15. STDMETHODIMP CGuideDataProvider::get_Description(BSTR *pbstrDescription)
  16. {
  17. ENTER_API
  18. {
  19. ValidateOut(pbstrDescription);
  20. return m_pdb->DescriptionPropSet::_get_OneParagraph((IGuideDataProvider *) this, pbstrDescription);
  21. }
  22. LEAVE_API
  23. }
  24. STDMETHODIMP CGuideDataProvider::put_Description(BSTR bstrDescription)
  25. {
  26. ENTER_API
  27. {
  28. ValidateIn(bstrDescription);
  29. return m_pdb->DescriptionPropSet::_put_OneParagraph((IGuideDataProvider *) this, bstrDescription);
  30. }
  31. LEAVE_API
  32. }
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CGuideDataProviders
  35. STDMETHODIMP CGuideDataProviders::get_ItemWithName(BSTR bstrName, IGuideDataProvider **ppdataprovider)
  36. {
  37. ENTER_API
  38. {
  39. ValidateIn(bstrName);
  40. ValidateOutPtr<IGuideDataProvider>(ppdataprovider, NULL);
  41. // UNDONE: Test
  42. CComPtr<IMetaPropertyType> pproptype= m_pdb->DescriptionPropSet::NameMetaPropertyType();
  43. CComPtr<IMetaProperty> pprop;
  44. HRESULT hr;
  45. hr = pproptype->get_New(0, _variant_t(bstrName), &pprop);
  46. if (FAILED(hr))
  47. return hr;
  48. CComPtr<IMetaPropertyCondition> ppropcond;
  49. hr = pprop->get_Cond(_bstr_t(_T("=")), &ppropcond);
  50. if (FAILED(hr))
  51. return hr;
  52. CComQIPtr<IObjects> pobjsThis(GetControllingUnknown());
  53. CComPtr<IObjects> pobjs;
  54. hr = pobjsThis->get_ItemsWithMetaPropertyCond(ppropcond, &pobjs);
  55. if (FAILED(hr))
  56. return hr;
  57. CComPtr<IUnknown> pobj;
  58. hr = pobjs->get_Item(_variant_t(0L), &pobj);
  59. if (FAILED(hr))
  60. return hr;
  61. hr = pobj->QueryInterface(__uuidof(IGuideDataProvider), (void **) ppdataprovider);
  62. return hr;
  63. }
  64. LEAVE_API
  65. }