#include "StdAfx.h"
#include "MBTNXXXXXXMgr.h"
CMBTNXXXXXXMgr::CMBTNXXXXXXMgr(void)
{
RemoveAll();
}
CMBTNXXXXXXMgr::~CMBTNXXXXXXMgr(void)
{
RemoveAll();
}
void CMBTNXXXXXXMgr::GetVector( CMBTNXXXXXXVector &vector )
{
vector.clear();
vector = m_vector;
}
bool CMBTNXXXXXXMgr::Add( CMBTNXXXXXX *pTNXXXXXX )
{
if( NULL == pTNXXXXXX )
return false;
m_vector.push_back(pTNXXXXXX);
return true;
}
bool CMBTNXXXXXXMgr::RemoveAll()
{
CMBTNXXXXXXVector::iterator it;
CMBTNXXXXXX *pTNXXXXXX = NULL;
for( it = m_vector.begin();it != m_vector.end();it++ )
{
pTNXXXXXX = *it;
delete pTNXXXXXX;
pTNXXXXXX = NULL;
}
m_vector.clear();
return true;
}
CString CMBTNXXXXXXMgr::GenXml()
{
CMBTNXXXXXXVector::iterator it;
CMBTNXXXXXX *pTNXXXXXX = NULL;
CString strXml,strTmpXml;
for( it = m_vector.begin();it != m_vector.end();it++ )
{
pTNXXXXXX = *it;
strTmpXml += pTNXXXXXX->GenXml();
}
strXml.Format(_T("
%s"),strTmpXml);
return strXml;
}
CString CMBTNXXXXXXMgr::GetMID()
{
CMBTNXXXXXXVector::iterator it;
CMBTNXXXXXX *pTNXXXXXX = NULL;
CString strTmpXml;
for( it = m_vector.begin();it != m_vector.end();it++ )
{
pTNXXXXXX = *it;
strTmpXml += pTNXXXXXX->m_strMID;
strTmpXml += _T(";");
}
strTmpXml = strTmpXml.Left(strTmpXml.GetLength()-1);
return strTmpXml;
}
CString CMBTNXXXXXXMgr::GetSID()
{
CMBTNXXXXXXVector::iterator it;
CMBTNXXXXXX *pTNXXXXXX = NULL;
CString strTmpXml;
for( it = m_vector.begin();it != m_vector.end();it++ )
{
pTNXXXXXX = *it;
strTmpXml += pTNXXXXXX->m_strSID;
strTmpXml += _T(";");
}
strTmpXml = strTmpXml.Left(strTmpXml.GetLength()-1);
return strTmpXml;
}
void CMBTNXXXXXXMgr::GetSID( CStringArray &arID )
{
arID.RemoveAll();
CMBTNXXXXXXVector::iterator it;
CMBTNXXXXXX *pTNXXXXXX = NULL;
for( it = m_vector.begin();it != m_vector.end();it++ )
{
pTNXXXXXX = *it;
arID.Add(pTNXXXXXX->m_strSID);
}
}