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.

173 lines
2.8 KiB

  1. #pragma once
  2. #include <map>
  3. #include <vector>
  4. #include <AdsiHelpers.h>
  5. #include "VarSetBase.h"
  6. class CFixObjectsInHierarchy
  7. {
  8. public:
  9. CFixObjectsInHierarchy();
  10. ~CFixObjectsInHierarchy();
  11. _bstr_t GetObjectType() const
  12. {
  13. return m_strObjectType;
  14. }
  15. void SetObjectType(LPCTSTR pszType)
  16. {
  17. m_strObjectType = pszType;
  18. }
  19. bool GetFixReplaced() const
  20. {
  21. return m_bFixReplaced;
  22. }
  23. void SetFixReplaced(bool bFix)
  24. {
  25. m_bFixReplaced = bFix;
  26. }
  27. _bstr_t GetSourceContainerPath() const
  28. {
  29. return m_strSourceContainerPath;
  30. }
  31. void SetSourceContainerPath(_bstr_t strPath)
  32. {
  33. m_strSourceContainerPath = strPath;
  34. }
  35. _bstr_t GetTargetContainerPath() const
  36. {
  37. return m_strTargetContainerPath;
  38. }
  39. void SetTargetContainerPath(_bstr_t strPath)
  40. {
  41. m_strTargetContainerPath = strPath;
  42. }
  43. void FixObjects();
  44. private:
  45. class CMigrated
  46. {
  47. public:
  48. CMigrated();
  49. ~CMigrated();
  50. void RetrieveMigratedObjects(int nActionId = -1);
  51. int GetCount();
  52. _bstr_t GetObjectType(int nIndex);
  53. int GetObjectStatus(int nIndex);
  54. _bstr_t GetObjectSourcePath(int nIndex);
  55. _bstr_t GetObjectTargetPath(int nIndex);
  56. void UpdateObjectTargetPath(int nIndex, _bstr_t strPath);
  57. public:
  58. enum EStatus
  59. {
  60. STATUS_CREATED = 0x00000001,
  61. STATUS_REPLACED = 0x00000002,
  62. STATUS_EXISTED = 0x00000004,
  63. };
  64. private:
  65. _bstr_t GetObjectKey(int nIndex);
  66. private:
  67. long m_lActionId;
  68. IIManageDBPtr m_spDB;
  69. CVarSet m_vsObjects;
  70. };
  71. class CTargetPath
  72. {
  73. public:
  74. CTargetPath();
  75. ~CTargetPath();
  76. void SetContainerPaths(_bstr_t strSourceContainerPath, _bstr_t strTargetContainerPath);
  77. bool NeedsToMove(_bstr_t strSourceObjectPath, _bstr_t strTargetObjectPath);
  78. _bstr_t GetTargetContainerPath();
  79. _bstr_t GetTargetObjectCurrentPath();
  80. private:
  81. bool IsMatch(LPCTSTR pszA, LPCTSTR pszB);
  82. private:
  83. CADsPathName m_pnSourceContainerPath;
  84. CADsPathName m_pnTargetContainerPath;
  85. CADsPathName m_pnTargetObjectOldPath;
  86. CADsPathName m_pnTargetObjectNewPath;
  87. };
  88. class CContainers;
  89. struct SObject
  90. {
  91. SObject(int nIndex, _bstr_t strPath) :
  92. m_nIndex(nIndex),
  93. m_strPath(strPath)
  94. {
  95. }
  96. SObject(const SObject& r) :
  97. m_nIndex(r.m_nIndex),
  98. m_strPath(r.m_strPath)
  99. {
  100. }
  101. SObject& operator =(const SObject& r)
  102. {
  103. m_nIndex = r.m_nIndex;
  104. m_strPath = r.m_strPath;
  105. return *this;
  106. }
  107. int m_nIndex;
  108. _bstr_t m_strPath;
  109. friend CContainers;
  110. };
  111. typedef std::vector<SObject> CObjects;
  112. class CContainers : public std::map<_bstr_t, CObjects>
  113. {
  114. public:
  115. CContainers() {}
  116. void InsertObject(_bstr_t strContainerPath, int nObjectIndex, _bstr_t strObjectPathOld);
  117. };
  118. private:
  119. _bstr_t m_strObjectType;
  120. bool m_bFixReplaced;
  121. _bstr_t m_strSourceContainerPath;
  122. _bstr_t m_strTargetContainerPath;
  123. CMigrated m_Migrated;
  124. CTargetPath m_TargetPath;
  125. CContainers m_Containers;
  126. };