📄 userdoc.cpp
字号:
// UserDoc.cpp : implementation file
//
#include "stdafx.h"
#include "miniSQL.h"
#include "UserDoc.h"
#include "Error.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserDoc
IMPLEMENT_DYNCREATE(CUserDoc, CDocument)
CUserDoc::CUserDoc()
{
}
BOOL CUserDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
m_UserList.RemoveAll();
return TRUE;
}
CUserDoc::~CUserDoc()
{
}
BEGIN_MESSAGE_MAP(CUserDoc, CDocument)
//{{AFX_MSG_MAP(CUserDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserDoc diagnostics
#ifdef _DEBUG
void CUserDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CUserDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CUserDoc serialization
void CUserDoc::Serialize(CArchive& ar)
{
CUser user;
int count = m_UserList.GetCount();
if (ar.IsStoring())
{
ar<<count;
for( int i = 0; i < count; i++ )
{
user = m_UserList.GetAt( m_UserList.FindIndex( i ) );
user.Serialize( ar );
}
ar<<'\0';
}
else
{
ar>>count;
m_UserList.RemoveAll();
for( int i = 0; i < count; i++ )
{
user.Serialize( ar );
m_UserList.AddTail( user );
}
char c;
ar>>c;
if( c != '\0' )
throw Error( ERROR_FILE_CORRUPTED, 0, _T("") );
}
}
/////////////////////////////////////////////////////////////////////////////
// CUserDoc commands
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -