filedata.cpp

来自「本文件包包含了大量用VC++开发的应用程序界面」· C++ 代码 · 共 100 行

CPP
100
字号
// FileData.cpp: implementation of the CFileData class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Rich.h"
#include "FileData.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

IMPLEMENT_SERIAL(CFileData, CObject, 0)

CFileData::CFileData()
{
	m_CreatedBy = _T("");
	m_CreatedTime = 0;
}

CFileData::~CFileData()
{

}

CArchive& operator<<(CArchive& ar, CFileData& history)
{
	ar.WriteString (history.m_CreatedBy);
	ar << '\n';
	ar << history.m_CreatedTime;
	int nItems = history.m_History.GetSize ();
	ar << nItems;
	for (int i = 0; i < nItems; ++i)
		ar << history.m_History[i];
	return (ar);
}

CArchive& operator>>(CArchive& ar, CFileData& history)
{
	ar.ReadString (history.m_CreatedBy);
	ar >> history.m_CreatedTime;
	int nItems;
	ar >> nItems;
	for (int i = 0; i < nItems; ++i)
	{
	CModified cm;
		ar >> cm;
		history.m_History.Add (cm);
	}
	return (ar);
}

//////////////////////////////////////////////////////////////////////
// CModified Class
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

IMPLEMENT_SERIAL(CModified, CObject, 0)

CModified::CModified()
{

}

CModified::~CModified()
{

}

CArchive& operator<<(CArchive& ar, CModified& data)
{
	ar.WriteString (data.m_ModUser);
	ar << '\n';
	ar << data.m_ModTime;
	return (ar);
}

CArchive& operator>>(CArchive& ar, CModified& data)
{
	ar.ReadString (data.m_ModUser);
	ar >> data.m_ModTime;
	return (ar);
}

CModified& CModified::operator=(CModified& data)
{
	m_ModUser = data.m_ModUser;
	m_ModTime = data.m_ModTime;
	return (*this);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?