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.

88 lines
1.9 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. PROJECT.CPP
  5. Abstract:
  6. History:
  7. --*/
  8. #include "project.h"
  9. void* CPropertyList::GetInterface(REFIID riid)
  10. {
  11. if(riid == IID_IHmmPropertyList)
  12. {
  13. return (IHmmPropertyList*)&m_XList;
  14. }
  15. else if(riid == IID_IConfigureHmmProjector)
  16. {
  17. return (IConfigureHmmProjector*)&m_XConfigure;
  18. }
  19. else
  20. {
  21. return NULL;
  22. }
  23. }
  24. STDMETHODIMP CPropertyList::XPropertyList::
  25. GetList(IN long lFlags, OUT long* plNumProps, OUT HMM_WSTR** pawszProps)
  26. {
  27. if(plNumProps == NULL || pawszProps == NULL)
  28. return HMM_E_INVALID_PARAMETER;
  29. *plNumProps = m_pObject->m_awsProperties.Size();
  30. *pawszProps = (HMM_WSTR*)CoTaskMemAlloc(sizeof(HMM_WSTR)* *plNumProps);
  31. for(long l = 0; l < *plNumProps; l++)
  32. {
  33. LPWSTR wszProp = m_pObject->m_awsProperties[l];
  34. (*pawszProps)[l] = HmmStringCopy(wszProp);
  35. }
  36. return HMM_S_NO_ERROR;
  37. }
  38. STDMETHODIMP CPropertyList::XPropertyList::
  39. IsSelected(IN HMM_WSTR wszProperty)
  40. {
  41. long lNumProps = m_pObject->m_awsProperties.Size();
  42. for(long l = 0; l < lNumProps; l++)
  43. {
  44. LPWSTR wszThis = m_pObject->m_awsProperties[l];
  45. int nLen = wcslen(wszThis);
  46. if(memcmp(wszThis, wszProperty, sizeof(WCHAR)*nLen) == 0)
  47. {
  48. if(nLen ==0 || wszProperty[nLen] == 0 || wszProperty[nLen] == L'.')
  49. {
  50. return HMM_S_NO_ERROR;
  51. }
  52. }
  53. }
  54. return HMM_S_FALSE;
  55. }
  56. STDMETHODIMP CPropertyList::XConfigure::
  57. AddProperties(IN long lNumProps, IN HMM_WSTR* awszProps)
  58. {
  59. if(awszProps == NULL)
  60. return HMM_E_INVALID_PARAMETER;
  61. for(long l = 0; l < lNumProps; l++)
  62. {
  63. m_pObject->m_awsProperties.Add(HmmStringCopy(awszProps[l]));
  64. }
  65. return HMM_S_NO_ERROR;
  66. }
  67. STDMETHODIMP CPropertyList::XConfigure::
  68. RemoveAllProperties()
  69. {
  70. m_pObject->m_awsProperties.Empty();
  71. return HMM_S_NO_ERROR;
  72. }