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.

100 lines
2.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: condition.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // Condition.cpp: implementation of the CCondition class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #include "precompiled.h"
  14. #include "Condition.h"
  15. #include "iasdebug.h"
  16. //
  17. // constructor
  18. //
  19. CCondition::CCondition(IIASAttributeInfo* pAttributeInfo, ATL::CString &strConditionText )
  20. : m_strConditionText(strConditionText)
  21. {
  22. m_spAttributeInfo = pAttributeInfo;
  23. }
  24. CCondition::CCondition(IIASAttributeInfo* pAttributeInfo)
  25. : m_strConditionText(L"")
  26. {
  27. m_spAttributeInfo = pAttributeInfo;
  28. }
  29. //+---------------------------------------------------------------------------
  30. //
  31. // Function: CCondition::GetDisplayText
  32. //
  33. // Synopsis: Get the displayable text for this condition
  34. // This is the default implementation, which simply returns the
  35. // condition text. The subclass should override this function
  36. //
  37. // Arguments: None
  38. //
  39. // Returns: ATL::CString& - displayable text
  40. //
  41. // History: Created Header byao 2/22/98 11:38:41 PM
  42. //
  43. //+---------------------------------------------------------------------------
  44. ATL::CString CCondition::GetDisplayText()
  45. {
  46. TRACE_FUNCTION("CCondition::GetDisplayText");
  47. // default implementation: as as condition text
  48. DebugTrace(DEBUG_NAPMMC_CONDITION, "GetDisplayText() returning %ws", m_strConditionText);
  49. return m_strConditionText;
  50. }
  51. //+---------------------------------------------------------------------------
  52. //
  53. // Function: CCondition::GetConditionText
  54. //
  55. // Synopsis: Get the condition text for this condition
  56. // This is the default implementation, which simply returns the
  57. // AttributeMatch-typed condition text. The subclass should override
  58. // this function
  59. //
  60. // Arguments: None
  61. //
  62. // Returns: WCHAR* - displayable text
  63. //
  64. // History: Created Header byao 2/22/98 11:38:41 PM
  65. //
  66. //+---------------------------------------------------------------------------
  67. WCHAR* CCondition::GetConditionText()
  68. {
  69. TRACE_FUNCTION("CCondition::GetConditionText");
  70. WCHAR *pwzCondText;
  71. pwzCondText = new WCHAR[m_strConditionText.GetLength()+128];
  72. if (pwzCondText == NULL)
  73. {
  74. ShowErrorDialog( NULL, IDS_ERROR_SDO_ERROR_GET_CONDTEXT, NULL);
  75. return NULL;
  76. }
  77. //
  78. // can't use wsprintf() here, because wsprintf() requires a buffer smaller than
  79. // 1024 chars
  80. //
  81. // wsprintf(pwzCondText, _T("%ws(\"%ws\")"), MATCH_PREFIX, (LPCTSTR)m_strConditionText);
  82. //
  83. wcscpy(pwzCondText, MATCH_PREFIX);
  84. wcscat(pwzCondText, _T("(\"") );
  85. wcscat(pwzCondText, (LPCTSTR)m_strConditionText);
  86. wcscat(pwzCondText, _T("\")"));
  87. DebugTrace(DEBUG_NAPMMC_CONDITION, "GetConditionText() returning %ws", pwzCondText);
  88. return pwzCondText;
  89. }