Files
envi-code/SourceCode/Code2026/tg_shs/shs_kernal/TAssocMsgContainer.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

83 lines
1.7 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