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.

80 lines
1.7 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1999 - 1999
  5. *
  6. * File: memento.cpp
  7. *
  8. * Contents: Implements the CMemento class
  9. *
  10. * History: 21-April-99 vivekj Created
  11. *
  12. *--------------------------------------------------------------------------*/
  13. #include "stgio.h"
  14. #include "stddbg.h"
  15. #include "macros.h"
  16. #include <comdef.h>
  17. #include "serial.h"
  18. #include "atlbase.h"
  19. //You may derive a class from CComModule and use it if you want to override
  20. //something, but do not change the name of _Module
  21. extern CComModule _Module;
  22. #include <atlcom.h>
  23. #include "cstr.h"
  24. #include <vector>
  25. #include "mmcdebug.h"
  26. #include "mmcerror.h"
  27. #include "mmc.h"
  28. #include "commctrl.h"
  29. #include "bookmark.h"
  30. #include "resultview.h"
  31. #include "viewset.h"
  32. #include "memento.h"
  33. bool
  34. CMemento::operator!=(const CMemento& memento)
  35. {
  36. return (!operator == (memento));
  37. }
  38. bool
  39. CMemento::operator==(const CMemento& memento)
  40. {
  41. if(m_viewSettings != memento.m_viewSettings)
  42. return false;
  43. if(m_bmTargetNode != memento.m_bmTargetNode)
  44. return false;
  45. return true;
  46. }
  47. HRESULT
  48. CMemento::ReadSerialObject (IStream &stm, UINT nVersion)
  49. {
  50. HRESULT hr = S_FALSE; // assume unknown version
  51. if (nVersion == 1)
  52. {
  53. try
  54. {
  55. stm >> m_bmTargetNode;
  56. hr = m_viewSettings.Read(stm);
  57. }
  58. catch (_com_error& err)
  59. {
  60. hr = err.Error();
  61. ASSERT (false && "Caught _com_error");
  62. }
  63. }
  64. return (hr);
  65. }
  66. void CMemento::Persist(CPersistor& persistor)
  67. {
  68. persistor.Persist(m_viewSettings);
  69. persistor.Persist(m_bmTargetNode);
  70. }