📄 arrayelem.cpp
字号:
// ArrayElem.cpp: implementation of the ArrayElem class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "map.h"
#include "ArrayElem.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ArrayElem::ArrayElem()
{
m_listcount=0;
}
ArrayElem::~ArrayElem()
{
}
//CString ArrayElem::GetCityName()const
//{
// return m_cityname;
//}
CString & ArrayElem::GetCityName()
{
return m_cityname;
}
CList<InfoNode,InfoNode &> & ArrayElem::GetList()
{
return m_list;
}
bool ArrayElem::operator ==(ArrayElem & temp)const
{
if(m_cityname==temp.m_cityname) return true;
else return false;
}
ArrayElem::ArrayElem(const ArrayElem & temp)
{
m_cityname=temp.m_cityname;
POSITION pos(NULL);
pos=temp.m_list.GetHeadPosition();
while(pos)
{
m_list.AddTail(temp.m_list.GetAt(pos));
temp.m_list.GetNext(pos);
}
}
ArrayElem & ArrayElem::operator =(ArrayElem & temp)
{
m_cityname=temp.m_cityname;
POSITION pos(NULL);
pos=temp.m_list.GetHeadPosition();
while(pos)
{
m_list.AddTail(temp.m_list.GetAt(pos));
temp.m_list.GetNext(pos);
}
return *this;
}
void ArrayElem::Serialize(CArchive& archive)
{
// CObject::Serialize(archive);
if(archive.IsStoring())
{
m_listcount=m_list.GetCount();
archive<<m_cityname;
archive<<m_listcount;
POSITION pos(NULL);
pos=m_list.GetHeadPosition();
while(pos){
m_list.GetAt(pos).Serialize(archive);
m_list.GetNext(pos);
};
}
else
{
archive>>m_cityname;
archive>>m_listcount;
InfoNode temp;
for(int i=1;i<=m_listcount;i++)
{
temp.Serialize(archive);
m_list.AddTail(temp);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -