#include "StdAfx.h" #include "MBQueryNdCatalogMgr.h" CMBQueryNdCatalogMgr::CMBQueryNdCatalogMgr(void) { } CMBQueryNdCatalogMgr::~CMBQueryNdCatalogMgr(void) { } bool CMBQueryNdCatalogMgr::AddCatalog(CMBQueryNdCatalog *pCatalog) { return AddCatalogObj(pCatalog); } // ÒÆ³ýĿ¼ bool CMBQueryNdCatalogMgr::RemoveAllCatalog() { return RemoveAllCatalogObj(); } bool CMBQueryNdCatalogMgr::ParseXml( CString &strXml,CString &strErrInfo ) { if( strXml.IsEmpty() ) { strErrInfo = _T("CMBCatalogMgr::ParseXml,²ÎÊýΪ¿Õ£¡"); return false; } pugi::xml_document xmlDoc; if (!xmlDoc.load(strXml)) { return false; } pugi::xml_node form = xmlDoc.child(_T("Body")).child(_T("Catalog")); for(pugi::xml_node node = form; node; node = node.next_sibling(_T("Catalog"))) { CMBQueryNdCatalog *pCatalogInfo = new CMBQueryNdCatalog(); //pCatalogInfo->m_strTreeID = CStrFileUtils::GenerateGuid(); pCatalogInfo->m_strID = node.attribute(_T("ID")).value(); pCatalogInfo->m_strListType = node.attribute(_T("ListType")).value(); pCatalogInfo->m_strOrder = node.attribute(_T("Order")).value(); CString strSubCount = node.attribute(_T("SubCount")).value(); pCatalogInfo->m_nSubCount = _ttoi(strSubCount); CString strFileCount = node.attribute(_T("FileCount")).value(); pCatalogInfo->m_nFileCount = _ttoi(strFileCount); pCatalogInfo->m_strDtCreate = node.attribute(_T("DTCreate")).value(); pCatalogInfo->m_strHasAce = node.attribute(_T("HasAce")).value(); pCatalogInfo->m_strPermit = node.attribute(_T("Permit")).value(); pCatalogInfo->m_strGlobalEdit = node.attribute(_T("GlobalEdit")).value(); pCatalogInfo->m_strMasterID = node.attribute(_T("MasterID")).value(); pCatalogInfo->m_strMasterName = node.attribute(_T("MasterName")).value(); pCatalogInfo->m_strName = node.child_value(_T("Name")); if( !AddCatalog(pCatalogInfo) ) { // Èç¹û´æÔÚ ÖØÖà bLoadCatalog GetCatalogObj( pCatalogInfo->m_strID )->m_bLoadCatalog = false; GetCatalogObj( pCatalogInfo->m_strID )->m_nSubCount = pCatalogInfo->m_nSubCount; GetCatalogObj( pCatalogInfo->m_strID )->m_nFileCount = pCatalogInfo->m_nFileCount; delete pCatalogInfo; pCatalogInfo = NULL; } } return true; }