83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
//------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TAssocMsgContainerÀà
|
|
// = Version : ver1.0
|
|
// = Author : cet
|
|
// = CreateDate : 2011-09-05
|
|
// = Description: ¹ØÁªÏûÏ¢ÈÝÆ÷ÀàʵÏÖ
|
|
// = Maintainers:
|
|
//
|
|
//------------------------------------------------------------------------+
|
|
|
|
#include "StdAfx.h"
|
|
#ifdef TASD
|
|
#include "TAssocMsgContainer.h"
|
|
|
|
TAssocMsgContainer::TAssocMsgContainer()
|
|
{
|
|
m_arAssocmsg.setLogicalLength(0);
|
|
}
|
|
|
|
TAssocMsgContainer::~TAssocMsgContainer()
|
|
{
|
|
m_arAssocmsg.setLogicalLength(0);
|
|
}
|
|
|
|
void TAssocMsgContainer::AddMsg( const TAssocMsg& msg )
|
|
{
|
|
TAssocMsg assocMsg = msg;
|
|
if (!m_arAssocmsg.contains(assocMsg))
|
|
{
|
|
m_arAssocmsg.append(assocMsg);
|
|
}
|
|
}
|
|
|
|
void TAssocMsgContainer::RemoveAt( int nIndex )
|
|
{
|
|
if (m_arAssocmsg.length() > nIndex && nIndex >= 0)
|
|
{
|
|
m_arAssocmsg.removeAt(nIndex);
|
|
}
|
|
}
|
|
|
|
void TAssocMsgContainer::Remove( const TAssocMsg& msg )
|
|
{
|
|
TAssocMsg assocMsg = msg;
|
|
m_arAssocmsg.remove(assocMsg);
|
|
}
|
|
|
|
void TAssocMsgContainer::RemoveAll()
|
|
{
|
|
if (m_arAssocmsg.length() > 0)
|
|
{
|
|
m_arAssocmsg.setLogicalLength(0);
|
|
}
|
|
}
|
|
|
|
void TAssocMsgContainer::GetTypeMsg( int nType, TAssocMsgArray& arMsg ) const
|
|
{
|
|
for (int i = 0; i < m_arAssocmsg.length(); i++)
|
|
{
|
|
if (m_arAssocmsg[i].GetMethod() == nType)
|
|
{
|
|
arMsg.append(m_arAssocmsg[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
bool TAssocMsgContainer::GetMsg( int nIndex, TAssocMsg& msg ) const
|
|
{
|
|
if (nIndex >= 0 && m_arAssocmsg.length() > nIndex)
|
|
{
|
|
msg = m_arAssocmsg[nIndex];
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
int TAssocMsgContainer::GetSize() const
|
|
{
|
|
return m_arAssocmsg.length();
|
|
}
|
|
#endif
|