📄 miniworddoc.cpp
字号:
// MiniwordDoc.cpp : implementation of the CMiniwordDoc class
//
#include "stdafx.h"
#include "Miniword.h"
#include "MiniwordDoc.h"
#include "StructWord.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
word* First;//定义链表的头结点
word* current;
CString buffer1;
CString reader;
int BufferSignal1=0;
//int StoreSignal=0;
/////////////////////////////////////////////////////////////////////////////
// CMiniwordDoc
IMPLEMENT_DYNCREATE(CMiniwordDoc, CDocument)
BEGIN_MESSAGE_MAP(CMiniwordDoc, CDocument)
//{{AFX_MSG_MAP(CMiniwordDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMiniwordDoc construction/destruction
CMiniwordDoc::CMiniwordDoc()
{
// TODO: add one-time construction code here
}
CMiniwordDoc::~CMiniwordDoc()
{
}
BOOL CMiniwordDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
SetTitle("新文档");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMiniwordDoc serialization
void CMiniwordDoc::Serialize(CArchive& ar)//序列化操作
{
if (ar.IsStoring())
{
// TODO: add storing code here
word* tempword;//存储功能
tempword=First;//定义一个遍历用的变量
CString all;//建立一个CString变量存储所有字符
while(tempword!=NULL){
all+=tempword->words;//将该行字符存到all
all+='\n';//存储一个回车符
tempword=tempword->downlink;
}
ar<<all;//输出到文件中
}
else
{
// TODO: add loading code here
word* tempword1;//实现打开功能
tempword1=First;
while(ar.ReadString(reader)){//从文件中读取字符
word* tempword2=new word;//将文件中内容存储到数据结构中
tempword2->words=reader;
tempword2->downlink=NULL;
tempword1->downlink=tempword2;
tempword1=tempword1->downlink;
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CMiniwordDoc diagnostics
#ifdef _DEBUG
void CMiniwordDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMiniwordDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMiniwordDoc commands
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -