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.

148 lines
3.9 KiB

  1. // CntrFinder.cpp -- AContainerFinder class implementation
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include "stdafx.h"
  8. #include <string>
  9. #include <scuOsExc.h>
  10. #include <scuCast.h>
  11. #include "ACntrFinder.h"
  12. using namespace std;
  13. using namespace scu;
  14. using namespace cci;
  15. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  16. /////////////////////////// PUBLIC HELPER /////////////////////////////////
  17. /////////////////////////// PUBLIC /////////////////////////////////
  18. // Types
  19. // C'tors/D'tors
  20. AContainerFinder::AContainerFinder(DialogDisplayMode ddm,
  21. HWND hwnd,
  22. CString const &rsDialogTitle)
  23. : ContainerFinder(ddm, hwnd, rsDialogTitle),
  24. m_hacntr()
  25. {}
  26. AContainerFinder::~AContainerFinder()
  27. {}
  28. // Operators
  29. // Operations
  30. Secured<HAdaptiveContainer>
  31. AContainerFinder::Find(CSpec const &rcsContainer)
  32. {
  33. DoFind(rcsContainer);
  34. return Secured<HAdaptiveContainer>(ContainerFound());
  35. }
  36. // Access
  37. // Predicates
  38. // Static Variables
  39. /////////////////////////// PROTECTED /////////////////////////////////
  40. // C'tors/D'tors
  41. // Operators
  42. // Operations
  43. void
  44. AContainerFinder::ContainerFound(HAdaptiveContainer &rhacntr)
  45. {
  46. m_hacntr = rhacntr;
  47. }
  48. void
  49. AContainerFinder::DoDisconnect()
  50. {
  51. ContainerFound(HAdaptiveContainer(0));
  52. CardFinder::DoDisconnect();
  53. }
  54. // Access
  55. HAdaptiveContainer
  56. AContainerFinder::ContainerFound() const
  57. {
  58. return m_hacntr;
  59. }
  60. // Predicates
  61. bool
  62. AContainerFinder::DoIsValid()
  63. {
  64. ContainerFound(HAdaptiveContainer(0));
  65. if (CardFinder::DoIsValid())
  66. {
  67. AdaptiveContainerKey Key(CardFound(),
  68. CardSpec().CardId());
  69. HAdaptiveContainer hacntr(AdaptiveContainer::Find(Key));
  70. ContainerFound(hacntr);
  71. }
  72. if (!ContainerFound())
  73. throw scu::OsException(NTE_BAD_KEYSET);
  74. return true;
  75. }
  76. void
  77. AContainerFinder::DoOnError()
  78. {
  79. CardFinder::DoOnError();
  80. scu::Exception const *pexc = Exception();
  81. if (pexc && (DialogDisplayMode::ddmNever != DisplayMode()))
  82. {
  83. switch (pexc->Facility())
  84. {
  85. case scu::Exception::fcOS:
  86. {
  87. scu::OsException const *pOsExc =
  88. DownCast<scu::OsException const *>(pexc);
  89. if (NTE_BAD_KEYSET == pOsExc->Cause())
  90. {
  91. YNPrompt(IDS_CONTAINER_NOT_FOUND);
  92. ClearException();
  93. }
  94. }
  95. break;
  96. default:
  97. break;
  98. }
  99. }
  100. }
  101. // Static Variables
  102. /////////////////////////// PRIVATE /////////////////////////////////
  103. // C'tors/D'tors
  104. // Operators
  105. // Operations
  106. // Access
  107. // Predicates
  108. // Static Variables