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.

64 lines
1.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // Condition.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // This file implements the class Condition.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/04/1998 Original version.
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #include <ias.h>
  19. #include <Condition.h>
  20. STDMETHODIMP Condition::get_ConditionText(BSTR *pVal)
  21. {
  22. if (!pVal) { return E_POINTER; }
  23. if (conditionText)
  24. {
  25. *pVal = SysAllocString(conditionText);
  26. if (*pVal == NULL) { return E_OUTOFMEMORY; }
  27. }
  28. else
  29. {
  30. *pVal = NULL;
  31. }
  32. return S_OK;
  33. }
  34. STDMETHODIMP Condition::put_ConditionText(BSTR newVal)
  35. {
  36. //////////
  37. // Make our own copy of newVal.
  38. //////////
  39. if (newVal)
  40. {
  41. if ((newVal = SysAllocString(newVal)) == NULL) { return E_OUTOFMEMORY; }
  42. }
  43. //////////
  44. // Free any exisiting condition.
  45. //////////
  46. if (conditionText)
  47. {
  48. SysFreeString(conditionText);
  49. }
  50. //////////
  51. // Make the assignment.
  52. //////////
  53. conditionText = newVal;
  54. return S_OK;
  55. }