poemdoc.cpp

来自「VC++技术内幕(第四版)的实例」· C++ 代码 · 共 91 行

CPP
91
字号
// poemdoc.cpp : implementation of the CPoemDoc class
//

#include "stdafx.h"
#include "ex19a.h"

#include "poemdoc.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPoemDoc

IMPLEMENT_DYNCREATE(CPoemDoc, CDocument)

BEGIN_MESSAGE_MAP(CPoemDoc, CDocument)
    //{{AFX_MSG_MAP(CPoemDoc)
        // 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()

/////////////////////////////////////////////////////////////////////////////
// CPoemDoc construction/destruction

CPoemDoc::CPoemDoc()
{
    // TODO: add one-time construction code here
}

CPoemDoc::~CPoemDoc()
{
}

void CPoemDoc::DeleteContents()
{
   // called before OnNewDocument and when document is closed
    m_stringArray.RemoveAll();
}

BOOL CPoemDoc::OnNewDocument()
{
    if (!CDocument::OnNewDocument())
        return FALSE;

    m_stringArray.SetSize(10);
    m_stringArray[0] = "The pennycandystore beyond the El";
    m_stringArray[1] = "is where I first";
    m_stringArray[2] = "                     fell in love";
    m_stringArray[3] = "                                    with unreality";
    m_stringArray[4] = "Jellybeans glowed in the semi-gloom";
    m_stringArray[5] = "of that september afternoon";
    m_stringArray[6] = "A cat upon the counter moved among";
    m_stringArray[7] = "                                           the licorice sticks";
    m_stringArray[8] = "                       and tootsie rolls";
    m_stringArray[9] = "           and Oh Boy Gum";

    return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CPoemDoc serialization

void CPoemDoc::Serialize(CArchive& ar)
{
    m_stringArray.Serialize(ar);
}


/////////////////////////////////////////////////////////////////////////////
// CPoemDoc diagnostics

#ifdef _DEBUG
void CPoemDoc::AssertValid() const
{
    CDocument::AssertValid();
}

void CPoemDoc::Dump(CDumpContext& dc) const
{
    CDocument::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CPoemDoc commands

⌨️ 快捷键说明

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