home *** CD-ROM | disk | FTP | other *** search
- // phndoc.cpp : implementation of the CPhnDoc class
- //
-
- #include "stdafx.h"
- #include "phn.h"
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- #include "phone.h"
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- #include "phndoc.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CPhnDoc
-
- IMPLEMENT_DYNCREATE(CPhnDoc, CDocument)
-
- BEGIN_MESSAGE_MAP(CPhnDoc, CDocument)
- //{{AFX_MSG_MAP(CPhnDoc)
- // 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()
-
- /////////////////////////////////////////////////////////////////////////////
- // CPhnDoc construction/destruction
-
- CPhnDoc::CPhnDoc()
- {
- // TODO: add one-time construction code here
- }
-
- CPhnDoc::~CPhnDoc()
- {
- }
-
- BOOL CPhnDoc::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
-
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Create an object of class CPhone.
- CPhone* pPhone = new CPhone();
- pPhone->m_Name = "";
- pPhone->m_Phone = "";
-
- // Add the new object to the m_PhoneList list.
- m_PhoneList.AddHead(pPhone);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- return TRUE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CPhnDoc serialization
-
- void CPhnDoc::Serialize(CArchive& ar)
- {
- if (ar.IsStoring())
- {
- // TODO: add storing code here
- }
- else
- {
- // TODO: add loading code here
-
- }
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- m_PhoneList.Serialize(ar);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CPhnDoc diagnostics
-
- #ifdef _DEBUG
- void CPhnDoc::AssertValid() const
- {
- CDocument::AssertValid();
- }
-
- void CPhnDoc::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CPhnDoc commands
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- void CPhnDoc::DeleteContents()
- {
-
- // Remove all the items in the list and free the
- // memory occupied by the listed objects.
- while ( !m_PhoneList.IsEmpty() )
- {
- delete m_PhoneList.RemoveHead();
- }
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-