STDXMLFileMnr.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. // PartSTDFileMnr.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "OTSModel.h"
  5. #include "STDXMLFileMnr.h"
  6. #include "OTSFileSys.h"
  7. #include "OTSHelper.h"
  8. #include "STDFileMgr.h"
  9. namespace OTSMODEL {
  10. using namespace OTSDATA;
  11. // CSTDXMLFileMnr
  12. // constructor
  13. CSTDXMLFileMnr::CSTDXMLFileMnr()
  14. {
  15. // initialization
  16. Init();
  17. }
  18. // copy constructor
  19. CSTDXMLFileMnr::CSTDXMLFileMnr(const CSTDXMLFileMnr& a_oSource)
  20. {
  21. // can't copy itself
  22. if (&a_oSource == this)
  23. {
  24. return;
  25. }
  26. // copy data over
  27. Duplicate(a_oSource);
  28. }
  29. // copy constructor
  30. CSTDXMLFileMnr::CSTDXMLFileMnr(CSTDXMLFileMnr* a_poSource)
  31. {
  32. // can't copy itself
  33. if (a_poSource == this)
  34. {
  35. return;
  36. }
  37. // copy data over
  38. Duplicate(*a_poSource);
  39. }
  40. // =operator
  41. CSTDXMLFileMnr& CSTDXMLFileMnr::operator=(const CSTDXMLFileMnr& a_oSource)
  42. {
  43. // cleanup
  44. Cleanup();
  45. // copy the class data over
  46. Duplicate(a_oSource);
  47. // return class
  48. return *this;
  49. }
  50. // ==operator
  51. BOOL CSTDXMLFileMnr::operator==(const CSTDXMLFileMnr& a_oSource)
  52. {
  53. // members
  54. return *(m_poPartSTDData.get()) == *(a_oSource.m_poPartSTDData.get());
  55. }
  56. // destructor
  57. CSTDXMLFileMnr::~CSTDXMLFileMnr()
  58. {
  59. // cleanup
  60. Cleanup();
  61. }
  62. // CSTDXMLFileMnr member functions
  63. // public
  64. // Load/Save
  65. BOOL CSTDXMLFileMnr::Load(CString a_strPathName /*= _T("")*/, BOOL a_bClear /*= TRUE*/)
  66. {
  67. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  68. // clear all data if necessary
  69. if (a_bClear)
  70. {
  71. Init();
  72. }
  73. // check file pathname
  74. a_strPathName.Trim();
  75. if (a_strPathName.IsEmpty())
  76. {
  77. // file open dialog
  78. CFileDialog dlg(TRUE, STD_FILE_EXT, NULL, OFN_FILEMUSTEXIST, STD_FILE_FILTER);
  79. if (dlg.DoModal() != IDOK)
  80. {
  81. return FALSE;
  82. }
  83. // get file pathname
  84. a_strPathName = dlg.GetPathName();
  85. }
  86. // create a new STD data file point
  87. CPartSTDDataPtr poPartSTDData = CPartSTDDataPtr(new CPartSTDData());
  88. // file version
  89. tinyxml2::XMLDocument doc;
  90. doc.LoadFile(a_strPathName);//载入xml文件
  91. tinyxml2::XMLElement *rootNode;
  92. rootNode = doc.FirstChildElement(RootClassName);
  93. poPartSTDData->Serialize(false, &doc, rootNode);
  94. CString strFileVersion = poPartSTDData->GetFileVersion();
  95. DWORD nFileVersion = COTSHelper::GetVersionFromString(strFileVersion);
  96. if (nFileVersion == 0)
  97. {
  98. // invalid file
  99. LogErrorTrace(__FILE__, __LINE__, _T("Load: invalid particle std data file %s"), a_strPathName);
  100. return FALSE;
  101. }
  102. m_poPartSTDData = poPartSTDData;
  103. // file pathname
  104. m_strPathName = a_strPathName;
  105. // set file modify flag to FALSE
  106. m_bModify = FALSE;
  107. // ok, return TRUE
  108. return TRUE;
  109. }
  110. BOOL CSTDXMLFileMnr::Save(CString a_strPathName /*= _T("")*/, CString a_LibraryName)
  111. {
  112. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  113. // check file pathname
  114. a_strPathName.Trim();
  115. if (a_strPathName.IsEmpty())
  116. {
  117. // file save as dialog
  118. CFileDialog dlg(FALSE, STD_FILE_EXT, NULL, OFN_OVERWRITEPROMPT, STD_FILE_FILTER);
  119. TCHAR _szPath[MAX_PATH + 1] = { 0 };
  120. GetModuleFileName(NULL, _szPath, MAX_PATH);
  121. (_tcsrchr(_szPath, _T('\\')))[1] = 0;//删除文件名,只获得路径字串
  122. CString strPath;
  123. for (int n = 0; _szPath[n]; n++) {
  124. if (_szPath[n] != _T('\\')) {
  125. strPath += _szPath[n];
  126. }
  127. else {
  128. strPath += _T("\\");
  129. }
  130. }
  131. CString Suffix = "Config\\ProData";
  132. CString FinalPath = strPath + Suffix;
  133. dlg.m_ofn.lpstrInitialDir = FinalPath;
  134. TCHAR szBuffer[MAX_PATH] = { 0 };
  135. CString dd = a_LibraryName; //"Sample1";
  136. _tcscpy(szBuffer, dd);
  137. dlg.m_ofn.lpstrFile = szBuffer;
  138. dlg.m_ofn.nMaxFile = sizeof(szBuffer) / sizeof(*szBuffer);
  139. if (dlg.DoModal() != IDOK)
  140. {
  141. return FALSE;
  142. }
  143. // get file pathname
  144. a_strPathName = dlg.GetPathName();
  145. }
  146. else {
  147. if (a_strPathName == ".\\Config\\ProData\\") {
  148. // file open dialog
  149. CFileDialog dlg(FALSE, STD_FILE_EXT, NULL, OFN_OVERWRITEPROMPT, TEXTAPTF_FILE_FILTER);
  150. TCHAR _szPath[MAX_PATH + 1] = { 0 };
  151. GetModuleFileName(NULL, _szPath, MAX_PATH);
  152. (_tcsrchr(_szPath, _T('\\')))[1] = 0;//删除文件名,只获得路径字串
  153. CString strPath;
  154. for (int n = 0; _szPath[n]; n++) {
  155. if (_szPath[n] != _T('\\')) {
  156. strPath += _szPath[n];
  157. }
  158. else {
  159. strPath += _T("\\");
  160. }
  161. }
  162. CString Suffix = "Config\\ProData";
  163. CString FinalPath = strPath + Suffix;
  164. dlg.m_ofn.lpstrInitialDir = FinalPath;
  165. TCHAR szBuffer[MAX_PATH] = { 0 };
  166. CString dd = a_LibraryName; //"Sample1";
  167. _tcscpy(szBuffer, dd);
  168. dlg.m_ofn.lpstrFile = szBuffer;
  169. dlg.m_ofn.nMaxFile = sizeof(szBuffer) / sizeof(*szBuffer);
  170. if (dlg.DoModal() != IDOK)
  171. {
  172. return FALSE;
  173. }
  174. // get file pathname
  175. a_strPathName = dlg.GetPathName();
  176. }
  177. else {
  178. CFileDialog dlg(FALSE, STD_FILE_EXT, NULL, OFN_OVERWRITEPROMPT, TEXTAPTF_FILE_FILTER);
  179. dlg.m_ofn.lpstrInitialDir = a_strPathName;
  180. TCHAR szBuffer[MAX_PATH] = { 0 };
  181. CString dd = a_LibraryName; //"Sample1";
  182. _tcscpy(szBuffer, dd);
  183. dlg.m_ofn.lpstrFile = szBuffer;
  184. dlg.m_ofn.nMaxFile = sizeof(szBuffer) / sizeof(*szBuffer);
  185. if (dlg.DoModal() != IDOK)
  186. {
  187. return FALSE;
  188. }
  189. // get file pathname
  190. a_strPathName = dlg.GetPathName();
  191. }
  192. }
  193. // create the file
  194. tinyxml2::XMLDocument doc;
  195. doc.LoadFile(a_strPathName);//载入xml文件
  196. doc.Clear();
  197. tinyxml2::XMLDeclaration* declaration = doc.NewDeclaration();//添加xml文件头申明
  198. doc.InsertFirstChild(declaration);
  199. tinyxml2::XMLElement *rootNode;
  200. rootNode = doc.NewElement(RootClassName);
  201. doc.InsertEndChild(rootNode);
  202. m_poPartSTDData->Serialize(true, &doc, rootNode);
  203. int result = doc.SaveFile(a_strPathName);
  204. // file pathname
  205. m_strPathName = a_strPathName;
  206. // set file modify flag to FALSE
  207. m_bModify = FALSE;
  208. // ok, return TRUE
  209. return TRUE;
  210. }
  211. // elements list
  212. CElementsList& CSTDXMLFileMnr::GetElementsList()
  213. {
  214. return m_poPartSTDData->GetElementsList();
  215. }
  216. void CSTDXMLFileMnr::SetElementsList(CElementsList& a_listElements, BOOL a_bClear)
  217. {
  218. m_poPartSTDData->SetElementsList(a_listElements, a_bClear);
  219. }
  220. CElementPtr CSTDXMLFileMnr::GetElementByIndex(int a_nIndex)
  221. {
  222. // element
  223. CElementPtr poElement = nullptr;
  224. // get elements list of particle analysis standard data
  225. CElementsList& listElements = m_poPartSTDData->GetElementsList();
  226. // get index related item
  227. if (a_nIndex >= 0 && a_nIndex < (int)listElements.size())
  228. {
  229. poElement = listElements[a_nIndex];
  230. }
  231. // return element
  232. return poElement;
  233. }
  234. BOOL CSTDXMLFileMnr::DeleteElementByIndex(int a_nIndex)
  235. {
  236. // get elements list of particle analysis standard data
  237. CElementsList& listElements = m_poPartSTDData->GetElementsList();
  238. if (a_nIndex < 0 || a_nIndex >(int)listElements.size())
  239. {
  240. // invalid index
  241. LogErrorTrace(__FILE__, __LINE__, _T("DeleteElementByIndex: invalid index."));
  242. return FALSE;
  243. }
  244. // remove the element
  245. listElements.erase(listElements.begin() + a_nIndex);
  246. // ok, return TRUE
  247. return TRUE;
  248. }
  249. BOOL CSTDXMLFileMnr::AddElement(CElementPtr a_poElement)
  250. {
  251. // input check
  252. ASSERT(a_poElement);
  253. if (!a_poElement)
  254. {
  255. // invalid element pointer
  256. LogErrorTrace(__FILE__, __LINE__, _T("AddElement: invalid input element pointer."));
  257. return FALSE;
  258. }
  259. // get elements list of particle analysis standard data
  260. CElementsList& listElements = m_poPartSTDData->GetElementsList();
  261. // make sure the element item is not already in the list
  262. int nAtomNum = a_poElement->GetAtomNum();
  263. auto itr = std::find_if(listElements.begin(), listElements.end(), [nAtomNum](CElementPtr& poElement) { return poElement->GetAtomNum() == nAtomNum; });
  264. if (itr != listElements.end())
  265. {
  266. // the element is already in the list
  267. LogErrorTrace(__FILE__, __LINE__, _T("AddElement: the element item is already in the list."));
  268. return FALSE;
  269. }
  270. // add the item into the list
  271. listElements.push_back(a_poElement);
  272. // ok, return TRUE
  273. return TRUE;
  274. }
  275. //std items list
  276. CSTDItemsList& CSTDXMLFileMnr::GetSTDItemsList()
  277. {
  278. return m_poPartSTDData->GetSTDItemsList();
  279. }
  280. void CSTDXMLFileMnr::SetSTDItemsList(CSTDItemsList& a_listSTDItems, BOOL a_bClear /*= TRUE*/)
  281. {
  282. // set std items list of the particle analysis standard data
  283. m_poPartSTDData->SetSTDItemsList(a_listSTDItems, a_bClear);
  284. }
  285. CSTDItemPtr CSTDXMLFileMnr::GetSTDItemByIndex(int a_nIndex)
  286. {
  287. // std item
  288. CSTDItemPtr poSDTItem = nullptr;
  289. // get std items list
  290. CSTDItemsList& listSTDItems = GetSTDItemsList();
  291. // get index related item
  292. if (a_nIndex >= 0 && a_nIndex < (int)listSTDItems.size())
  293. {
  294. poSDTItem = listSTDItems[a_nIndex];
  295. }
  296. // return std item
  297. return poSDTItem;
  298. }
  299. CSTDItemPtr CSTDXMLFileMnr::GetSTDItemById(int a_nId)
  300. {
  301. // safety check
  302. ASSERT(m_poPartSTDData);
  303. if (!m_poPartSTDData)
  304. {
  305. // invalid m_poPartSTDData pointer
  306. LogErrorTrace(__FILE__, __LINE__, _T("GetSTDItemById: invalid m_poPartSTDData pointer."));
  307. return nullptr;
  308. }
  309. // return std item
  310. return m_poPartSTDData->GetSTDItemById(a_nId);
  311. }
  312. BOOL CSTDXMLFileMnr::DeleteSTDItemByIndex(int a_nIndex)
  313. {
  314. // get std items list
  315. CSTDItemsList& listSTDItems = GetSTDItemsList();
  316. if (a_nIndex < 0 || a_nIndex >(int)listSTDItems.size())
  317. {
  318. // invalid index
  319. LogErrorTrace(__FILE__, __LINE__, _T("DeleteSTDItemByIndex: invalid index."));
  320. return FALSE;
  321. }
  322. // remove the std item
  323. listSTDItems.erase(listSTDItems.begin() + a_nIndex);
  324. // ok, return TRUE
  325. return TRUE;
  326. }
  327. BOOL CSTDXMLFileMnr::MoveSTDItemDown(int a_nIndex)
  328. {
  329. // get std items list
  330. CSTDItemsList& listSTDItems = GetSTDItemsList();
  331. if (a_nIndex < 0 || a_nIndex >(int)listSTDItems.size())
  332. {
  333. // invalid index
  334. LogErrorTrace(__FILE__, __LINE__, _T("MoveSTDItemDown: invalid index."));
  335. return FALSE;
  336. }
  337. else if (a_nIndex == (int)listSTDItems.size() - 1)
  338. {
  339. // last item can't be move down
  340. LogErrorTrace(__FILE__, __LINE__, _T("MoveSTDItemDown: last item, can't be moved down."));
  341. return FALSE;
  342. }
  343. // change the position the the two related items
  344. std::swap(listSTDItems[a_nIndex], listSTDItems[a_nIndex + 1]);
  345. std::string a = "";
  346. // ok, return TRUE
  347. return TRUE;
  348. }
  349. BOOL CSTDXMLFileMnr::MoveSTDItemUp(int a_nIndex)
  350. {
  351. // get std items list
  352. CSTDItemsList& listSTDItems = GetSTDItemsList();
  353. if (a_nIndex < 0 || a_nIndex >(int)listSTDItems.size())
  354. {
  355. // invalid index
  356. LogErrorTrace(__FILE__, __LINE__, _T("MoveSTDItemUp: invalid index."));
  357. return FALSE;
  358. }
  359. else if (a_nIndex == 0)
  360. {
  361. // first item can't be move up
  362. LogErrorTrace(__FILE__, __LINE__, _T("MoveSTDItemDown: first item, can't be moved up."));
  363. return FALSE;
  364. }
  365. // change the position the the two related items
  366. std::swap(listSTDItems[a_nIndex], listSTDItems[a_nIndex - 1]);
  367. // ok, return TRUE
  368. return TRUE;
  369. }
  370. BOOL CSTDXMLFileMnr::AddSTDItem(CSTDItemPtr a_poSTDItem)
  371. {
  372. // input check
  373. ASSERT(a_poSTDItem);
  374. if (!a_poSTDItem)
  375. {
  376. // invalid std item pointer
  377. LogErrorTrace(__FILE__, __LINE__, _T("AddSTDItem: invalid input std item pointer."));
  378. return FALSE;
  379. }
  380. // get std items list
  381. CSTDItemsList& listSTDItems = GetSTDItemsList();
  382. // make sure there is no a same name item in the list
  383. CString strName = a_poSTDItem->GetName();
  384. auto itr = std::find_if(listSTDItems.begin(), listSTDItems.end(), [strName](CSTDItemPtr& poSTDItem) { return poSTDItem->GetName().CompareNoCase(strName) == 0; });
  385. if (itr != listSTDItems.end())
  386. {
  387. // same name std item already in the list
  388. LogErrorTrace(__FILE__, __LINE__, _T("AddSTDItem: same name std item already in the list. %s"), strName);
  389. return FALSE;
  390. }
  391. // add the item into the list
  392. listSTDItems.push_back(a_poSTDItem);
  393. // ok, return TRUE
  394. return TRUE;
  395. }
  396. BOOL CSTDXMLFileMnr::InsertSTDItem(int a_nIndex, CSTDItemPtr a_poSTDItem)
  397. {
  398. // input check
  399. ASSERT(a_poSTDItem);
  400. if (!a_poSTDItem)
  401. {
  402. // invalid std item pointer
  403. LogErrorTrace(__FILE__, __LINE__, _T("InsertSTDItem: invalid input std item pointer."));
  404. return FALSE;
  405. }
  406. // get std items list
  407. CSTDItemsList& listSTDItems = GetSTDItemsList();
  408. // check index value
  409. if (a_nIndex < 0 || a_nIndex >(int)listSTDItems.size())
  410. {
  411. // invalid index
  412. LogErrorTrace(__FILE__, __LINE__, _T("InsertSTDItem: invalid index."));
  413. return FALSE;
  414. }
  415. // make sure there is no a same name item in the list
  416. CString strName = a_poSTDItem->GetName();
  417. auto itr = std::find_if(listSTDItems.begin(), listSTDItems.end(), [strName](CSTDItemPtr& poSTDItem) { return poSTDItem->GetName().CompareNoCase(strName) == 0; });
  418. if (itr != listSTDItems.end())
  419. {
  420. // same name std item already in the list
  421. LogErrorTrace(__FILE__, __LINE__, _T("InsertSTDItem: same name std item already in the list. %s"), strName);
  422. return FALSE;
  423. }
  424. // insert the std item
  425. listSTDItems.insert(listSTDItems.begin() + a_nIndex, a_poSTDItem);
  426. // ok, return TRUE
  427. return TRUE;
  428. }
  429. BOOL CSTDXMLFileMnr::EditSTDItem(int a_nIndex, CSTDItemPtr a_poSTDItem)
  430. {
  431. // input check
  432. ASSERT(a_poSTDItem);
  433. if (!a_poSTDItem)
  434. {
  435. // invalid std item pointer
  436. LogErrorTrace(__FILE__, __LINE__, _T("EditSTDItem: invalid input std item pointer."));
  437. return FALSE;
  438. }
  439. // get std items list
  440. CSTDItemsList& listSTDItems = GetSTDItemsList();
  441. // check index value
  442. if (a_nIndex < 0 || a_nIndex >(int)listSTDItems.size())
  443. {
  444. // invalid index
  445. LogErrorTrace(__FILE__, __LINE__, _T("EditSTDItem: invalid index."));
  446. return FALSE;
  447. }
  448. // make sure there is no a same name item in the list
  449. CString strName = a_poSTDItem->GetName();
  450. if (a_nIndex > 0)
  451. {
  452. auto itr = std::find_if(listSTDItems.begin(), listSTDItems.begin() + a_nIndex - 1, [strName](CSTDItemPtr& poSTDItem) { return poSTDItem->GetName().CompareNoCase(strName) == 0; });
  453. if (itr != listSTDItems.end())
  454. {
  455. // same name std item already in the list
  456. LogErrorTrace(__FILE__, __LINE__, _T("EditSTDItem: same name std item already in the list. %s"), strName);
  457. return FALSE;
  458. }
  459. }
  460. else if (a_nIndex != (int)listSTDItems.size() - 1)
  461. {
  462. auto itr = std::find_if(listSTDItems.begin() + a_nIndex + 1, listSTDItems.end(), [strName](CSTDItemPtr& poSTDItem) { return poSTDItem->GetName().CompareNoCase(strName) == 0; });
  463. if (itr != listSTDItems.end())
  464. {
  465. // same name std item already in the list
  466. LogErrorTrace(__FILE__, __LINE__, _T("EditSTDItem: same name std item already in the list. %s"), strName);
  467. return FALSE;
  468. }
  469. }
  470. // replace the std item
  471. *(listSTDItems[a_nIndex].get()) = *(a_poSTDItem.get());
  472. // ok, return TRUE
  473. return TRUE;
  474. }
  475. void CSTDXMLFileMnr::SetPartSTDData(CPartSTDDataPtr a_pPartSTDData)
  476. {
  477. ASSERT(a_pPartSTDData);
  478. if (!a_pPartSTDData)
  479. {
  480. LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalid pointer."));
  481. return;
  482. }
  483. // library name
  484. m_poPartSTDData->SetName(a_pPartSTDData->GetName());
  485. CElementsList plistCurrentElement;
  486. plistCurrentElement.clear();
  487. // elements list
  488. CElementsList plistElements = a_pPartSTDData->GetElementsList();
  489. for (auto pElement : plistElements)
  490. {
  491. ASSERT(pElement);
  492. if (!pElement)
  493. {
  494. LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalid element pointer."));
  495. return;
  496. }
  497. CElementPtr pCurrentElement = CElementPtr(new CElement(*pElement.get()));
  498. plistCurrentElement.push_back(pCurrentElement);
  499. }
  500. m_poPartSTDData->SetElementsList(plistCurrentElement, TRUE);
  501. CSTDItemsList plistCurrentSTDItem;
  502. plistCurrentSTDItem.clear();
  503. CSTDItemsList plistSTDItems = a_pPartSTDData->GetSTDItemsList();
  504. for (auto pSTDItem : plistSTDItems)
  505. {
  506. ASSERT(pSTDItem);
  507. if (!pSTDItem)
  508. {
  509. LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalid STD Item pointer."));
  510. return;
  511. }
  512. CSTDItemPtr pCurrentSTDItem = CSTDItemPtr(new CSTDItem(*pSTDItem.get()));
  513. plistCurrentSTDItem.push_back(pCurrentSTDItem);
  514. }
  515. m_poPartSTDData->SetSTDItemsList(plistCurrentSTDItem, TRUE);
  516. }
  517. // protected
  518. // cleanup
  519. void CSTDXMLFileMnr::Cleanup()
  520. {
  521. // need to do nothing at the moment
  522. }
  523. // initialization
  524. void CSTDXMLFileMnr::Init()
  525. {
  526. // initialization
  527. m_strPathName = _T("");
  528. m_bModify = FALSE;
  529. m_poPartSTDData = CPartSTDDataPtr(new CPartSTDData());
  530. //m_poSTDFileMgr = CSTDFileMgrPtr(new CSTDFileMgr());
  531. }
  532. // duplication
  533. void CSTDXMLFileMnr::Duplicate(const CSTDXMLFileMnr& a_oSource)
  534. {
  535. // initialization
  536. Init();
  537. // copy data over
  538. m_strPathName = a_oSource.m_strPathName;
  539. m_bModify = a_oSource.m_bModify;
  540. m_poPartSTDData = CPartSTDDataPtr(new CPartSTDData(*a_oSource.m_poPartSTDData.get()));
  541. //m_poSTDFileMgr = CSTDFileMgrPtr(new CSTDFileMgr(*a_oSource.m_poSTDFileMgr.get()));
  542. }
  543. /*void CSTDXMLFileMnr::SetDBSTDFileMgr(CSTDFileMgrPtr a_pSTDFileMgr)
  544. {
  545. ASSERT(a_pSTDFileMgr);
  546. if (!a_pSTDFileMgr)
  547. {
  548. LogErrorTrace(__FILE__, __LINE__, _T("SetSTDFileMgr: invalid pointer."));
  549. return;
  550. }
  551. m_poSTDFileMgr = CSTDFileMgrPtr(new CSTDFileMgr(*a_pSTDFileMgr.get()));
  552. }*/
  553. }