Main Page

Praktikum MFC Documentation

Generated for Praktikum/MFC © August 2001 by Stephan Brumme


File Index

Praktikum MFC File List

Here is a list of all files with brief descriptions:
  • AboutDialog.cpp [code] (Class CAboutDialog (implementation))
  • AboutDialog.h [code] (Class CAboutDialog (interface))
  • BankDocument.cpp [code] (Class CBankDocument (implementation))
  • BankDocument.h [code] (Class CBankDocument (interface))
  • BankDocumentDialog.cpp [code] (Class CBankDocumentDialog (implementation))
  • BankDocumentDialog.h [code] (Class CBankDocumentDialog (interface))
  • ChildFrm.cpp [code] (Class CChildFrame (implementation))
  • ChildFrm.h [code] (Class CChildFrame (interface))
  • Contract.cpp [code] (Class CContract (implementation))
  • Contract.h [code] (Class CContract (interface))
  • ContractDialog.cpp [code] (Class CContractDialog (implementation))
  • ContractDialog.h [code] (Class CContractDialog (interface))
  • DumpDialog.cpp [code] (Class CDumpDialog (implementation))
  • DumpDialog.h [code] (Class Debug::CDumpDialog (interface))
  • FileTrace.h [code] (Class Debug::CFileTrace (interface+implementation))
  • Folder.cpp [code] (Class CFolder (implementation))
  • Folder.h [code] (Class CFolder (interface))
  • FolderDialog.cpp [code] (Class CFolderDialog (implementation))
  • FolderDialog.h [code] (Class CFolderDialog (interface))
  • Form.cpp [code] (Class CForm (implementation))
  • Form.h [code] (Class CForm (interface))
  • FormDialog.cpp [code] (Class CFormDialog (implementation))
  • FormDialog.h [code] (Class CFormDialog (interface))
  • MainFrm.cpp [code] (Class CMainFrame (implementation))
  • MainFrm.h [code] (Class CMainFrame (interface))
  • MyDate.cpp [code] (Class CMyDate (implementation))
  • MyDate.h [code] (Class CMyDate (interface))
  • PolymorphicSet.h [code] (Template CPolymorphicSet<C> (interface + implementation))
  • PraktikumMFC.cpp [code] (Class CPraktikumMFCApp (implementation))
  • PraktikumMFC.h [code] (Class CPraktikumMFCApp (interface))
  • PraktikumMFCDoc.cpp [code] (Class CPraktikumMFCDoc (implementation))
  • PraktikumMFCDoc.h [code] (Class CPraktikumMFCDoc (interface))
  • PraktikumMFCView.cpp [code] (Class CPraktikumMFCView (implementation))
  • PraktikumMFCView.h [code] (Class CPraktikumMFCView (interface))
  • resource.h [code]
  • Scenario.cpp [code] (Class Debug::CScenario (implementation))
  • Scenario.h [code] (Class Debug::CScenario (interface))
  • StandingOrder.cpp [code] (Class CStandingOrder (implementation))
  • StandingOrder.h [code] (Class CStandingOrder (interface))
  • StandingOrderDialog.cpp [code] (Class CStandingOrderDialog (implementation))
  • StandingOrderDialog.h [code] (Class CStandingOrderDialog (interface))
  • StdAfx.cpp [code] (Build pre-compiled headers out of MFC default includes)
  • StdAfx.h [code] (MFC default includes)
  • Trace.cpp [code] (Class Debug::CTrace (implementation))
  • Trace.h [code] (Class Debug::CTrace (interface))


AboutDialog.cpp File Reference

class CAboutDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file AboutDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 14 of file AboutDialog.cpp.


AboutDialog.h File Reference

class CAboutDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file AboutDialog.h.


BankDocument.cpp File Reference

class CBankDocument (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file BankDocument.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 13 of file BankDocument.cpp.


BankDocument.h File Reference

class CBankDocument (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file BankDocument.h.


BankDocumentDialog.cpp File Reference

class CBankDocumentDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file BankDocumentDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file BankDocumentDialog.cpp.


BankDocumentDialog.h File Reference

class CBankDocumentDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file BankDocumentDialog.h.


ChildFrm.cpp File Reference

class CChildFrame (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Controller

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file ChildFrm.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 16 of file ChildFrm.cpp.


ChildFrm.h File Reference

class CChildFrame (interface). More...

Go to the source code of this file.

Namespaces

namespace Controller

Detailed Description

Definition in file ChildFrm.h.


Contract.cpp File Reference

class CContract (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file Contract.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 13 of file Contract.cpp.


Contract.h File Reference

class CContract (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file Contract.h.


ContractDialog.cpp File Reference

class CContractDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file ContractDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file ContractDialog.cpp.


ContractDialog.h File Reference

class CContractDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file ContractDialog.h.


DumpDialog.cpp File Reference

class CDumpDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Debug

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file DumpDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 16 of file DumpDialog.cpp.


DumpDialog.h File Reference

class Debug::CDumpDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace Debug

Detailed Description

Definition in file DumpDialog.h.


FileTrace.h File Reference

class Debug::CFileTrace (interface+implementation). More...

Go to the source code of this file.

Namespaces

namespace Debug

Detailed Description

Author:
Stephan Brumme and Paul DiLascia
Date:
August 18, 2001

Definition in file FileTrace.h.


Folder.cpp File Reference

class CFolder (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file Folder.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file Folder.cpp.


Folder.h File Reference

class CFolder (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file Folder.h.


FolderDialog.cpp File Reference

class CFolderDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file FolderDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file FolderDialog.cpp.


FolderDialog.h File Reference

class CFolderDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file FolderDialog.h.


Form.cpp File Reference

class CForm (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file Form.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 13 of file Form.cpp.


Form.h File Reference

class CForm (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file Form.h.


FormDialog.cpp File Reference

class CFormDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file FormDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file FormDialog.cpp.


FormDialog.h File Reference

class CFormDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file FormDialog.h.


MainFrm.cpp File Reference

class CMainFrame (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Controller

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file MainFrm.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 16 of file MainFrm.cpp.


MainFrm.h File Reference

class CMainFrame (interface). More...

Go to the source code of this file.

Namespaces

namespace Controller

Detailed Description

Definition in file MainFrm.h.


MyDate.cpp File Reference

class CMyDate (implementation). More...

Go to the source code of this file.

Variables

char THIS_FILE [] = __FILE__

Detailed Description

Definition in file MyDate.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 16 of file MyDate.cpp.


MyDate.h File Reference

class CMyDate (interface). More...

Go to the source code of this file.

Compounds

class CMyDate
Stores date and time. More...

Detailed Description

Definition in file MyDate.h.


PolymorphicSet.h File Reference

template CPolymorphicSet<C> (interface + implementation). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file PolymorphicSet.h.


PraktikumMFC.cpp File Reference

class CPraktikumMFCApp (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Application

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file PraktikumMFC.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 28 of file PraktikumMFC.cpp.


PraktikumMFC.h File Reference

class CPraktikumMFCApp (interface). More...

Go to the source code of this file.

Namespaces

namespace Application

Detailed Description

Definition in file PraktikumMFC.h.


PraktikumMFCDoc.cpp File Reference

class CPraktikumMFCDoc (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file PraktikumMFCDoc.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 29 of file PraktikumMFCDoc.cpp.


PraktikumMFCDoc.h File Reference

class CPraktikumMFCDoc (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file PraktikumMFCDoc.h.


PraktikumMFCView.cpp File Reference

class CPraktikumMFCView (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file PraktikumMFCView.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 26 of file PraktikumMFCView.cpp.


PraktikumMFCView.h File Reference

class CPraktikumMFCView (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file PraktikumMFCView.h.


resource.h File Reference

Go to the source code of this file.


Scenario.cpp File Reference

class Debug::CScenario (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Debug

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file Scenario.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 16 of file Scenario.cpp.


Scenario.h File Reference

class Debug::CScenario (interface). More...

Go to the source code of this file.

Namespaces

namespace Debug

Detailed Description

Definition in file Scenario.h.


StandingOrder.cpp File Reference

class CStandingOrder (implementation). More...

Go to the source code of this file.

Namespaces

namespace | Model

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file StandingOrder.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 13 of file StandingOrder.cpp.


StandingOrder.h File Reference

class CStandingOrder (interface). More...

Go to the source code of this file.

Namespaces

namespace Model

Detailed Description

Definition in file StandingOrder.h.


StandingOrderDialog.cpp File Reference

class CStandingOrderDialog (implementation). More...

Go to the source code of this file.

Namespaces

namespace | View

Variables

char | THIS_FILE [] = __FILE__

Detailed Description

Definition in file StandingOrderDialog.cpp.

Variable Documentation

char THIS_FILE[] = __FILE__ [static]

Definition at line 15 of file StandingOrderDialog.cpp.


StandingOrderDialog.h File Reference

class CStandingOrderDialog (interface). More...

Go to the source code of this file.

Namespaces

namespace View

Detailed Description

Definition in file StandingOrderDialog.h.


StdAfx.cpp File Reference

build pre-compiled headers out of MFC default includes. More...

Go to the source code of this file.

Detailed Description

Definition in file StdAfx.cpp.


StdAfx.h File Reference

MFC default includes. More...

Go to the source code of this file.

Detailed Description

Definition in file StdAfx.h.


Trace.cpp File Reference

class Debug::CTrace (implementation). More...

Go to the source code of this file.

Namespaces

namespace Debug

Detailed Description

Definition in file Trace.cpp.


Trace.h File Reference

class Debug::CTrace (interface). More...

Go to the source code of this file.

Namespaces

namespace Debug

Detailed Description

Definition in file Trace.h.


Annotated Index

Praktikum MFC Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
  • View::CAboutDialog (A dialog that displays some general info)
  • Model::CBankDocument (A basic bank document)
  • View::CBankDocumentDialog (A dialog to create/display CBankDocument)
  • Controller::CChildFrame (The MDI child frame)
  • Model::CContract (A contract)
  • View::CContractDialog (A dialog to create/edit CContract)
  • CDialog
  • CDocument
  • Debug::CDumpDialog (A modeless dialog that displays DEBUG output)
  • CFile
  • Debug::CFileTrace (CFileTrace is a CFile that "writes" to the trace window)
  • Model::CFolder (A folder)
  • View::CFolderDialog (A dialog to create/display CFolder)
  • Model::CForm (A form)
  • View::CFormDialog (A dialog to create/edit CForm)
  • CListView
  • Controller::CMainFrame (The MDI main frame)
  • CMDIChildWnd
  • CMDIFrameWnd
  • CMyDate (Stores date and time)
  • CObject
  • Model::CPolymorphicSet< C > (Template of a polymorphic set)
  • Application::CPraktikumMFCApp (The main class)
  • Model::CPraktikumMFCDoc (The main document)
  • View::CPraktikumMFCView (The main view)
  • Debug::CScenario (Generate scenarios)
  • Model::CStandingOrder (A standing order)
  • View::CStandingOrderDialog (A dialog to create/edit CStandingOrder)
  • Debug::CTrace (Generic debug info class)
  • CWinApp


View::CAboutDialog Class Reference

A dialog that displays some general info. More...

#include <AboutDialog.h>

Inheritance diagram for View::CAboutDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_ABOUTBOX }
ID of the used dialog resource. More...

Public Methods

CAboutDialog ()
constructor. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • (none)

Definition at line 22 of file AboutDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 31 of file AboutDialog.h.

00031 { IDD = IDD_ABOUTBOX };

Constructor & Destructor Documentation

View::CAboutDialog::CAboutDialog ( )

Route dialog ID down to CDialog

Definition at line 24 of file AboutDialog.cpp.

00024                            : CDialog(CAboutDialog::IDD)
00025 {
00026     //{{AFX_DATA_INIT(CAboutDialog)
00027     //}}AFX_DATA_INIT
00028 }

Member Function Documentation

void View::CAboutDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Definition at line 35 of file AboutDialog.cpp.

00036 {
00037     CDialog::DoDataExchange(pDX);
00038     //{{AFX_DATA_MAP(CAboutDialog)
00039     //}}AFX_DATA_MAP
00040 }

The documentation for this class was generated from the following files:
  • AboutDialog.h
  • AboutDialog.cpp


Model::CBankDocument Class Reference

A basic bank document. More...

#include <BankDocument.h>

Inheritance diagram for Model::CBankDocument::

CObject Model::CContract Model::CForm Model::CStandingOrder List of all members.

Public Methods

CBankDocument ()
default constructor. More...

CBankDocument (const CBankDocument &bankdocument)
copy constructor. More...

CBankDocument (CString strAuthor, CString strTitle, CString strKey)
explicitly set author, title and key. More...

virtual | ~CBankDocument ()
destructor. More...

virtual CObject * | Generate () const
create a new object. More...

virtual CObject * | GenerateC () const
clone this object. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate the folder. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

virtual CBankDocument & | operator= (const CBankDocument &bankdocument)
copy. More...

virtual bool | operator== (const CBankDocument &bankdocument) const
compare value. More...

bool | EqualKey (const CBankDocument &bankdocument) const
compare keys. More...

bool | Equal (const CObject *object) const
check for identity. More...

virtual CString | KeyOf () const
deliver a unique identifier. More...

CString | GetAuthor () const
get author. More...

CString | GetTitle () const
get title. More...

CString | GetKey () const
get key. More...

CMyDate | GetDateOfFoundation () const
get date of foundation. More...

Private Attributes

CString | m_strAuthor
author. More...

CString | m_strTitle
title. More...

CString | m_strKey
key. More...

CMyDate m_dtDateOfFoundation
date of foundation. More...

Detailed Description

  • base class for all other bank-related classes
Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • each CString attribute must be non-empty
  • m_dtDateOfFoundation must be valid

Definition at line 26 of file BankDocument.h.

Constructor & Destructor Documentation

Model::CBankDocument::CBankDocument ( )

Constructs a new bank document with the current date/time

See also:
CMyDate()

Definition at line 26 of file BankDocument.cpp.

Referenced by GenerateC().

00027 {
00028     m_dtDateOfFoundation = CMyDate();
00029 }

Model::CBankDocument::CBankDocument ( const CBankDocument & bankdocument )

Copies an existing CBankDocument

Parameters:
bankdocument bank document to be copied
See also:
operator=

Definition at line 37 of file BankDocument.cpp.

00038 {
00039     operator=(bankdocument);
00040 }

Model::CBankDocument::CBankDocument | ( | CString | strAuthor,
 |  | CString | strTitle,
 |  | CString | strKey
 | ) |

Constructs a new bank document using given author, title and key

Parameters:
strAuthor | author
strTitle | title
strKey | key

Definition at line 49 of file BankDocument.cpp.

00050 {
00051     // copy parameters
00052     m_strAuthor = strAuthor;
00053     m_strTitle  = strTitle;
00054     m_strKey    = strKey;
00055     // refresh date
00056     m_dtDateOfFoundation = CMyDate();
00057 }

Model::CBankDocument::~CBankDocument ( ) [virtual]

No clean-up required

Definition at line 63 of file BankDocument.cpp.

00064 {
00065 }

Member Function Documentation

CObject * Model::CBankDocument::Generate ( ) const [virtual]

Create a new non-initialized object

Returns:
new instance of CBankDocument

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 72 of file BankDocument.cpp.

00073 {
00074     return new CBankDocument;
00075 }

CObject * Model::CBankDocument::GenerateC ( ) const [virtual]

Clone this object

Returns:
exact copy

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 82 of file BankDocument.cpp.

00083 {
00084     return new CBankDocument(*this);
00085 }

void Model::CBankDocument::Serialize ( CArchive & ar ) [virtual]

Loads/stores CBankDocument

Parameters:
ar CArchive that provides data persistency

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 92 of file BankDocument.cpp.

00093 {
00094     CObject::Serialize(ar);
00095
00096     if (ar.IsStoring())
00097         ar << m_strAuthor << m_strTitle << m_strKey;
00098     else
00099         ar >> m_strAuthor >> m_strTitle >> m_strKey;
00100
00101     // << and >> operators are not overloaded
00102     m_dtDateOfFoundation.Serialize(ar);
00103 }

void Model::CBankDocument::AssertValid ( ) const [virtual]

Determines whether the bank document is valid, invariant describes further details (see above)

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 110 of file BankDocument.cpp.

00111 {
00112     CObject::AssertValid();
00113
00114     ASSERT(!m_strAuthor.IsEmpty());
00115     ASSERT(!m_strTitle .IsEmpty());
00116     ASSERT(!m_strKey   .IsEmpty());
00117
00118     ASSERT_VALID(&m_dtDateOfFoundation);
00119 }

void Model::CBankDocument::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 126 of file BankDocument.cpp.

00127 {
00128     CObject::Dump(dc);
00129
00130     dc << "author: " << m_strAuthor << "\n"
00131        << "title:  " << m_strTitle  << "\n"
00132        << "key:    " << m_strKey    << "\n"
00133        << "date:   ";
00134     // << operator is not overloaded
00135     m_dtDateOfFoundation.Dump(dc);
00136 }

CBankDocument & Model::CBankDocument::operator= ( const CBankDocument & bankdocument ) [virtual]

Copies all attributes

Parameters:
bankdocument CBankDocument that should be copied
Returns:
reference to the copied bank document

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 144 of file BankDocument.cpp.

Referenced by CBankDocument().

00145 {
00146     // copy attributes
00147     m_strAuthor = bankdocument.m_strAuthor;
00148     m_strTitle  = bankdocument.m_strTitle;
00149     m_strKey    = bankdocument.m_strKey;
00150     m_dtDateOfFoundation = bankdocument.m_dtDateOfFoundation;
00151
00152     return *this;
00153 }

bool Model::CBankDocument::operator== ( const CBankDocument & bankdocument ) const [virtual]

Compare attributes (except key) of two bank documents

Parameters:
bankdocument CBankDocument that we compare to
Returns:
true, if all attributes are equal

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 161 of file BankDocument.cpp.

00162 {
00163     return (m_strAuthor == bankdocument.m_strAuthor &&
00164             m_strTitle  == bankdocument.m_strTitle  &&
00165             m_strKey    == bankdocument.m_strKey    );
00166 //            m_dtDateOfFoundation == bankdocument.m_dtDateOfFoundation);
00167 }

bool Model::CBankDocument::EqualKey ( const CBankDocument & bankdocument ) const

Compare keys

Parameters:
bankdocument CBankDocument that we compare to
Returns:
true, if keys are equal

Definition at line 175 of file BankDocument.cpp.

00176 {
00177     return (KeyOf() == bankdocument.KeyOf());
00178 }

bool Model::CBankDocument::Equal ( const CObject * object ) const

Check for object identity

Parameters:
object object that we compare to
Returns:
true, if both objects are identical

Definition at line 186 of file BankDocument.cpp.

00187 {
00188     return (this == object);
00189 }

CString Model::CBankDocument::KeyOf ( ) const [virtual]

Responsible for the generation of a unique key based on the object's attributes

Returns:
CString that contains the key

Reimplemented in Model::CContract, Model::CForm, and Model::CStandingOrder.

Definition at line 196 of file BankDocument.cpp.

Referenced by EqualKey().

00197 {
00198     CString strKey;
00199     strKey.Format("[%s|%s|%s|%s|%p]", m_strAuthor, m_strTitle,  m_strKey,
00200                                       m_dtDateOfFoundation.KeyOf(),
00201                                       this);
00202     return strKey;
00203 }

CString Model::CBankDocument::GetAuthor ( ) const

Get author

Returns:
author

Definition at line 210 of file BankDocument.cpp.

00211 {
00212     return m_strAuthor;
00213 }

CString Model::CBankDocument::GetTitle ( ) const

Get title

Returns:
title

Definition at line 218 of file BankDocument.cpp.

00219 {
00220     return m_strTitle;
00221 }

CString Model::CBankDocument::GetKey ( ) const

Get key

Returns:
key

Definition at line 226 of file BankDocument.cpp.

00227 {
00228     return m_strKey;
00229 }

CMyDate Model::CBankDocument::GetDateOfFoundation ( ) const

Get date of foundation

Returns:
date of foundation

Definition at line 234 of file BankDocument.cpp.

00235 {
00236     return m_dtDateOfFoundation;
00237 }

Member Data Documentation

CString Model::CBankDocument::m_strAuthor [private]

Definition at line 92 of file BankDocument.h.

CString Model::CBankDocument::m_strTitle [private]

Definition at line 95 of file BankDocument.h.

CString Model::CBankDocument::m_strKey [private]

Definition at line 98 of file BankDocument.h.

CMyDate Model::CBankDocument::m_dtDateOfFoundation [private]

Definition at line 101 of file BankDocument.h.

The documentation for this class was generated from the following files:
  • BankDocument.h
  • BankDocument.cpp


View::CBankDocumentDialog Class Reference

A dialog to create/display CBankDocument. More...

#include <BankDocumentDialog.h>

Inheritance diagram for View::CBankDocumentDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_BANKDOCUMENT }
ID of the used dialog resource. More...

Public Methods

CBankDocumentDialog (bool bInitialize=false, CWnd *pParent=NULL)
constructor. More...

Public Attributes

CString | m_strAuthor
value of "author" edit control. More...

CString | m_strDateOfFoundation
value of "date of foundation" control. More...

CString | m_strKey
value of "key" edit control. More...

CString | m_strTitle
value of "title" edit control. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnChange ()

Protected Attributes

bool | m_bInitialize
true, if used to construct a new CBankDocument (enable more controls). More...

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • each CString attribute must be non-empty
  • invariant is verified by OnOK

Definition at line 23 of file BankDocumentDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 31 of file BankDocumentDialog.h.

00031 { IDD = IDD_BANKDOCUMENT };

Constructor & Destructor Documentation

View::CBankDocumentDialog::CBankDocumentDialog | ( | bool | bInitialize = false,
 |  | CWnd * | pParent = NULL
 | ) |

Initialize all dialog controls and get dialog mode (create or display CBankDocument)

Parameters:
bInitialize | true, if used to create a new CBankDocument
pParent | handle of the parent window (not used)

Definition at line 26 of file BankDocumentDialog.cpp.

00027     : CDialog(CBankDocumentDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CBankDocumentDialog)
00030     m_strAuthor = _T("");
00031     m_strDateOfFoundation = _T("");
00032     m_strKey = _T("");
00033     m_strTitle = _T("");
00034     //}}AFX_DATA_INIT
00035
00036     m_bInitialize = bInitialize;
00037 }

Member Function Documentation

void View::CBankDocumentDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object
See also:
OnOK

Definition at line 46 of file BankDocumentDialog.cpp.

00047 {
00048     CDialog::DoDataExchange(pDX);
00049     //{{AFX_DATA_MAP(CBankDocumentDialog)
00050     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00051     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00052     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00053     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00054     //}}AFX_DATA_MAP
00055 }

BOOL View::CBankDocumentDialog::OnInitDialog ( ) [protected, virtual]

Enable/disable dialog controls to differ between creation and display mode

See also:
CBankDocumentDialog()

Definition at line 62 of file BankDocumentDialog.cpp.

00063 {
00064     CDialog::OnInitDialog();
00065
00066     // controls are only writeable if used for construction of a new object
00067     if (m_bInitialize)
00068     {
00069         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetReadOnly(FALSE);
00070         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR))->SetReadOnly(FALSE);
00071         ((CEdit*)GetDlgItem(IDC_EDIT_KEY   ))->SetReadOnly(FALSE);
00072
00073         // set cursor to title edit control
00074         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00075
00076         // disallow MFC to change the focus we set
00077         return FALSE;
00078     }
00079
00080     // done, MFC may automatically set focus according to tab order
00081     return TRUE;
00082 }

void View::CBankDocumentDialog::OnOK ( ) [protected, virtual]

Verify control's values and exit if all are valid

See also:
DoDataExchange

Definition at line 89 of file BankDocumentDialog.cpp.

00090 {
00091     // data exchange
00092     UpdateData();
00093
00094     // validate m_strTitle
00095     if (m_strTitle.IsEmpty())
00096     {
00097         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00098         return;
00099     }
00100
00101     // validate m_strAuthor
00102     if (m_strAuthor.IsEmpty())
00103     {
00104         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00105         return;
00106     }
00107
00108     // validate m_strKey
00109     if (m_strKey.IsEmpty())
00110     {
00111         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00112         return;
00113     }
00114
00115     // done
00116     CDialog::OnOK();
00117 }

afx_msg void View::CBankDocumentDialog::OnChange ( ) [protected]

Member Data Documentation

CString View::CBankDocumentDialog::m_strAuthor

Definition at line 34 of file BankDocumentDialog.h.

CString View::CBankDocumentDialog::m_strDateOfFoundation

Definition at line 37 of file BankDocumentDialog.h.

CString View::CBankDocumentDialog::m_strKey

Definition at line 40 of file BankDocumentDialog.h.

CString View::CBankDocumentDialog::m_strTitle

Definition at line 43 of file BankDocumentDialog.h.

bool View::CBankDocumentDialog::m_bInitialize [protected]

Definition at line 57 of file BankDocumentDialog.h.

The documentation for this class was generated from the following files:
  • BankDocumentDialog.h
  • BankDocumentDialog.cpp


Controller::CChildFrame Class Reference

The MDI child frame. More...

#include <ChildFrm.h>

Inheritance diagram for Controller::CChildFrame::

CMDIChildWnd List of all members.

Public Methods

CChildFrame ()
default constructor. More...

virtual void | ActivateFrame (int nCmdShow=-1)

Protected Attributes

bool | m_bActivated
true, if window is newly created. More...

Detailed Description

Author:
Visual Studio Wizard
Date:
August 23, 2001

Definition at line 19 of file ChildFrm.h.

Constructor & Destructor Documentation

Controller::CChildFrame::CChildFrame ( )

nothing left to do

Definition at line 26 of file ChildFrm.cpp.

00027 {
00028     m_bActivated = false;
00029 }

Member Function Documentation

void Controller::CChildFrame::ActivateFrame ( int nCmdShow = -1 ) [virtual]

activate child window and maximize if possible

Parameters:
nCmdShow window style on activation

Definition at line 36 of file ChildFrm.cpp.

00037 {
00038     if (!m_bActivated)
00039     {
00040         m_bActivated = true;
00041         nCmdShow = SW_SHOWMAXIMIZED;
00042     }
00043
00044     CMDIChildWnd::ActivateFrame(nCmdShow);
00045 }

Member Data Documentation

bool Controller::CChildFrame::m_bActivated [protected]

Definition at line 39 of file ChildFrm.h.

The documentation for this class was generated from the following files:
  • ChildFrm.h
  • ChildFrm.cpp


Model::CContract Class Reference

A contract. More...

#include <Contract.h>

Inheritance diagram for Model::CContract::

Model::CBankDocument CObject List of all members.

Public Methods

CContract ()
default constructor. More...

CContract (const CContract &contract)
copy constructor. More...

CContract (CString strAuthor, CString strTitle, CString strKey, unsigned int nRegistrationNumber, bool bProved, bool bSigned, CString strWording)
explicitly set attributes. More...

virtual | ~CContract ()
destructor. More...

virtual CObject * | Generate () const
create a new object. More...

virtual CObject * | GenerateC () const
clone this object. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate the contract. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

CContract & | operator= (const CContract &contract)
copy. More...

virtual CBankDocument & | operator= (const CBankDocument &bankdocument)
polymorphic copy. More...

bool | operator== (const CContract &contract) const
comparison. More...

virtual bool | operator== (const CBankDocument &bankdocument) const
polymorphic comparison. More...

virtual CString | KeyOf () const
deliver a unique identifier. More...

bool | GetProved () const
determine whether form is proved. More...

bool | GetSigned () const
determine whether form is signed. More...

CString | GetWording () const
get formality. More...

CMyDate | GetAlterationDate () const
get alteration date. More...

unsigned int | GetRegistrationNumber () const
get registration number. More...

void | SetProved (bool bProved)
set "proved" property. More...

void | SetSigned (bool bSigned)
set "signed" property. More...

void | SetWording (CString strWording)
set wording. More...

Protected Methods

void | HasChanged ()
at least one attribute has changed. More...

Private Attributes

unsigned int | m_nRegistrationNumber
registration number. More...

CMyDate m_dtAlterationDate
alteration date. More...

bool | m_bProved
"proved" property. More...

bool | m_bSigned
"signed" property. More...

CString | m_strWording
wording. More...

Detailed Description

Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • m_nRegistrationNumber is positive
  • m_dtAlterationDate must be valid
  • m_strWording must be non-empty
  • parent class must be valid

Definition at line 27 of file Contract.h.

Constructor & Destructor Documentation

Model::CContract::CContract ( )

Constructs a new unproved and unsigned contract

Definition at line 24 of file Contract.cpp.

Referenced by GenerateC().

00025 {
00026     m_bProved = m_bSigned = false;
00027     m_nRegistrationNumber = 0;
00028 }

Model::CContract::CContract ( const CContract & contract )

Copies an existing CContract

Parameters:
contract contract to be copied
See also:
operator=

Definition at line 36 of file Contract.cpp.

00037 {
00038     operator=(contract);
00039 }

Model::CContract::CContract | ( | CString | strAuthor,
 |  | CString | strTitle,
 |  | CString | strKey,
 |  | unsigned int | nRegistrationNumber,
 |  | bool | bProved,
 |  | bool | bSigned,
 |  | CString | strWording
 | ) |

Definition at line 43 of file Contract.cpp.

00046          : CBankDocument(strAuthor, strTitle, strKey)
00047 {
00048     m_nRegistrationNumber = nRegistrationNumber;
00049     m_bProved = bProved;
00050     m_bSigned = bSigned;
00051     m_strWording = strWording;
00052     m_dtAlterationDate = CMyDate();
00053 }

Model::CContract::~CContract ( ) [virtual]

No clean-up required

Definition at line 59 of file Contract.cpp.

00060 {
00061 }

Member Function Documentation

CObject * Model::CContract::Generate ( ) const [virtual]

Create a new non-initialized object

Returns:
new instance of CContract

Reimplemented from Model::CBankDocument.

Definition at line 68 of file Contract.cpp.

00069 {
00070     return new CContract;
00071 }

CObject * Model::CContract::GenerateC ( ) const [virtual]

Clone this object

Returns:
exact copy

Reimplemented from Model::CBankDocument.

Definition at line 78 of file Contract.cpp.

00079 {
00080     return new CContract(*this);
00081 }

void Model::CContract::Serialize ( CArchive & ar ) [virtual]

Loads/stores CContract

Parameters:
ar CArchive that provides data persistency

Reimplemented from Model::CBankDocument.

Definition at line 88 of file Contract.cpp.

00089 {
00090     // serialize parent
00091     CBankDocument::Serialize(ar);
00092
00093     // CArchive can't handle "bool" so I have to use "BOOL" (which is "int" ...)
00094     BOOL bProved = m_bProved,
00095          bSigned = m_bSigned;
00096
00097     if (ar.IsStoring())
00098         ar << bProved << bSigned << m_nRegistrationNumber << m_strWording;
00099     else
00100         ar >> bProved >> bSigned >> m_nRegistrationNumber >> m_strWording;
00101
00102     // neccessary because of MFC's "bool!=BOOL story"
00103     m_bProved = (bProved == TRUE);
00104     m_bSigned = (bSigned == TRUE);
00105
00106     // << and >> operators are not overloaded
00107     m_dtAlterationDate.Serialize(ar);
00108 }

void Model::CContract::AssertValid ( ) const [virtual]

Determines whether the contract is valid, invariant describes further details (see above)

Reimplemented from Model::CBankDocument.

Definition at line 115 of file Contract.cpp.

00116 {
00117     CBankDocument::AssertValid();
00118
00119     ASSERT(!m_strWording.IsEmpty());
00120     ASSERT(m_nRegistrationNumber > 0);
00121     ASSERT_VALID(&m_dtAlterationDate);
00122 }

void Model::CContract::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented from Model::CBankDocument.

Definition at line 129 of file Contract.cpp.

Referenced by operator=(), and operator==().

00130 {
00131     CBankDocument::Dump(dc);
00132
00133     dc << "\n"
00134        << "registration number: " << m_nRegistrationNumber << "\n"
00135        << "proved: " << m_bProved << "\n"
00136        << "signed: " << m_bSigned << "\n"
00137        << "wording: " << m_strWording << "\n"
00138        << "alternation date: ";
00139
00140     m_dtAlterationDate.Dump(dc);
00141 }

CContract & Model::CContract::operator= ( const CContract & contract )

Copies all attributes

Parameters:
contract CContract that should be copied
Returns:
reference to the copied form

Definition at line 149 of file Contract.cpp.

Referenced by CContract(), and operator=().

00150 {
00151     // copy inherited attributes
00152     CBankDocument::operator =(contract);
00153
00154     // copy CContract's attributes
00155     m_bProved = contract.m_bProved;
00156     m_bSigned = contract.m_bSigned;
00157     m_dtAlterationDate    = contract.m_dtAlterationDate;
00158     m_strWording          = contract.m_strWording;
00159     m_nRegistrationNumber = contract.m_nRegistrationNumber;
00160
00161     return *this;
00162 }

CBankDocument & Model::CContract::operator= ( const CBankDocument & bankdocument ) [virtual]

Copies all attributes for polymorphic behaviour

Parameters:
bankdocument CContract (casted as CBankDocument) that should be copied
Returns:
reference to the copied form

Reimplemented from Model::CBankDocument.

Definition at line 170 of file Contract.cpp.

00171 {
00172     try
00173     {
00174         // copy all attributes
00175         operator =(dynamic_cast<const CContract&>(bankdocument));
00176     }
00177     catch(...)
00178     {
00179         // invalid class
00180 #ifdef _DEBUG
00181         TRACE("Copy denied because of invalid cast (needed a CContract)\n");
00182         Dump(afxDump);
00183         bankdocument.Dump(afxDump);
00184 #endif
00185     }
00186
00187     return *this;
00188 }

bool Model::CContract::operator== ( const CContract & contract ) const

Compare attributes (except key) of two contracts

Parameters:
form CContract that we compare to
Returns:
true, if all attributes are equal

Definition at line 196 of file Contract.cpp.

Referenced by operator==().

00197 {
00198     return (CBankDocument::operator ==(contract) &&
00199             m_bProved == contract.m_bProved &&
00200             m_bSigned == contract.m_bSigned &&
00201 //            m_dtAlterationDate    == contract.m_dtAlterationDate &&
00202             m_strWording          == contract.m_strWording &&
00203             m_nRegistrationNumber == contract.m_nRegistrationNumber);
00204 }

bool Model::CContract::operator== ( const CBankDocument & bankdocument ) const [virtual]

Compares all attributes for polymorphic behaviour

Parameters:
bankdocument CContract (casted as CBankDocument) that should be compared to
Returns:
true, if all attributes are equal

Reimplemented from Model::CBankDocument.

Definition at line 212 of file Contract.cpp.

00213 {
00214     try
00215     {
00216         // compare all attributes
00217         return operator ==(dynamic_cast<const CContract&>(bankdocument));
00218     }
00219     catch(...)
00220     {
00221         // invalid class
00222         TRACE("Comparison denied because of invalid cast\n"
00223               "(needed a CContract and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00224 #ifdef _DEBUG
00225         Dump(afxDump);
00226         bankdocument.Dump(afxDump);
00227 #endif
00228     }
00229
00230     return false;
00231 }

CString Model::CContract::KeyOf ( ) const [virtual]

Responsible for the generation of a unique key based on the object's attributes

Returns:
CString that contains the key

Reimplemented from Model::CBankDocument.

Definition at line 238 of file Contract.cpp.

00239 {
00240     CString strKey;
00241     strKey.Format("[%d|%s|%d|%d|%s|%s|%p]", m_nRegistrationNumber,
00242                                             m_strWording, m_bProved,  m_bSigned,
00243                                             m_dtAlterationDate.KeyOf(),
00244                                             CBankDocument::KeyOf(),
00245                                             this);
00246     return strKey;
00247 }

bool Model::CContract::GetProved ( ) const

Get "proved" property

Returns:
true, if form is proved

Definition at line 254 of file Contract.cpp.

00255 {
00256     return m_bProved;
00257 }

bool Model::CContract::GetSigned ( ) const

Get "signed" property

Returns:
true, if form is signed

Definition at line 262 of file Contract.cpp.

00263 {
00264     return m_bSigned;
00265 }

CString Model::CContract::GetWording ( ) const

Get wording

Returns:
wording

Definition at line 270 of file Contract.cpp.

00271 {
00272     return m_strWording;
00273 }

CMyDate Model::CContract::GetAlterationDate ( ) const

Get alteration date

Returns:
alteration date

Definition at line 278 of file Contract.cpp.

00279 {
00280     return m_dtAlterationDate;
00281 }

unsigned int Model::CContract::GetRegistrationNumber ( ) const

Get registration number

Returns:
registration number

Definition at line 286 of file Contract.cpp.

00287 {
00288     return m_nRegistrationNumber;
00289 }

void Model::CContract::SetProved ( bool bProved )

Set "proved" property

Parameters:
bProved true, if form is proved

Definition at line 296 of file Contract.cpp.

00297 {
00298     m_bProved = bProved;
00299     // update alteration date
00300     HasChanged();
00301 }

void Model::CContract::SetSigned ( bool bSigned )

Set "signed" property

Parameters:
bSigned true, if form is signed

Definition at line 306 of file Contract.cpp.

00307 {
00308     m_bSigned = bSigned;
00309     // update alteration date
00310     HasChanged();
00311 }

void Model::CContract::SetWording ( CString strWording )

Set wording

Parameters:
strWording wording

Definition at line 316 of file Contract.cpp.

00317 {
00318     m_strWording = strWording;
00319     // update alteration date
00320     HasChanged();
00321 }

void Model::CContract::HasChanged ( ) [protected]

Update date of alteration

Definition at line 327 of file Contract.cpp.

Referenced by SetProved(), SetSigned(), and SetWording().

00328 {
00329     m_dtAlterationDate = CMyDate();
00330 }

Member Data Documentation

unsigned int Model::CContract::m_nRegistrationNumber [private]

Definition at line 114 of file Contract.h.

CMyDate Model::CContract::m_dtAlterationDate [private]

Definition at line 117 of file Contract.h.

bool Model::CContract::m_bProved [private]

Definition at line 120 of file Contract.h.

bool Model::CContract::m_bSigned [private]

Definition at line 123 of file Contract.h.

CString Model::CContract::m_strWording [private]

Definition at line 126 of file Contract.h.

The documentation for this class was generated from the following files:
  • Contract.h
  • Contract.cpp


View::CContractDialog Class Reference

A dialog to create/edit CContract. More...

#include <ContractDialog.h>

Inheritance diagram for View::CContractDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_CONTRACT }
ID of the used dialog resource. More...

Public Methods

CContractDialog (bool bInitialize=false, CWnd *pParent=NULL)
constructor. More...

Public Attributes

BOOL | m_bProved
value of "proved" checkbox control. More...

BOOL | m_bSigned
value of "signed" checkbox control. More...

CString | m_strAlterationDate
value of "alteration date" control. More...

CString | m_strAuthor
value of "author" edit control. More...

CString | m_strDateOfFoundation
value of "date of foundation" control. More...

CString | m_strKey
value of "key" edit control. More...

int | m_nRegistrationNumber
value of "registration" edit control. More...

CString | m_strTitle
value of "title" edit control. More...

CString | m_strWording
value of "wording" edit control. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

void | OnChange ()
virtual BOOL | OnInitDialog ()
virtual void | OnOK ()
afx_msg void | OnChangea ()

Protected Attributes

bool | m_bInitialize
true, if used to construct a new CContract (enable more controls). More...

bool | m_bModified

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • each CString attribute must be non-empty
  • registration number must be positive
  • invariant is verified by OnOK

Definition at line 24 of file ContractDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 32 of file ContractDialog.h.

00032 { IDD = IDD_CONTRACT };

Constructor & Destructor Documentation

View::CContractDialog::CContractDialog | ( | bool | bInitialize = false,
 |  | CWnd * | pParent = NULL
 | ) |

Initialize all dialog controls and get dialog mode (create or edit CContract)

Parameters:
bInitialize | true, if used to create a new CContract
pParent | handle of the parent window (not used)

Definition at line 26 of file ContractDialog.cpp.

00027     : CDialog(CContractDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CContractDialog)
00030     m_bProved = FALSE;
00031     m_bSigned = FALSE;
00032     m_strAlterationDate = _T("");
00033     m_strAuthor = _T("");
00034     m_strDateOfFoundation = _T("");
00035     m_strKey = _T("");
00036     m_nRegistrationNumber = 0;
00037     m_strTitle = _T("");
00038     m_strWording = _T("");
00039     //}}AFX_DATA_INIT
00040
00041     m_bInitialize = bInitialize;
00042     m_bModified   = false;
00043 }

Member Function Documentation

void View::CContractDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object
See also:
OnOK

Definition at line 52 of file ContractDialog.cpp.

00053 {
00054     CDialog::DoDataExchange(pDX);
00055     //{{AFX_DATA_MAP(CContractDialog)
00056     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00057     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00058     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00059     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00060     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00061     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00062     DDX_Text(pDX, IDC_EDIT_REGISTRATIONNUMBER, m_nRegistrationNumber);
00063     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00064     DDX_Text(pDX, IDC_EDIT_WORDING, m_strWording);
00065     //}}AFX_DATA_MAP
00066 }

void View::CContractDialog::OnChange ( ) [protected]

Definition at line 148 of file ContractDialog.cpp.

00149 {
00150     m_bModified = true;
00151 }

BOOL View::CContractDialog::OnInitDialog ( ) [protected, virtual]

Enable/disable dialog controls to differ between creation and edit mode

See also:
CContractDialog()

Definition at line 73 of file ContractDialog.cpp.

00074 {
00075     CDialog::OnInitDialog();
00076
00077     // controls are only writeable if used for construction of a new object
00078     if (m_bInitialize)
00079     {
00080         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00081         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00082         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00083         ((CEdit*)GetDlgItem(IDC_EDIT_REGISTRATIONNUMBER))->SetReadOnly(FALSE);
00084
00085         // set cursor to title edit control
00086         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00087
00088         // disallow MFC to change the focus we set
00089         return FALSE;
00090     }
00091
00092     // done, MFC may automatically set focus according to tab order
00093     return TRUE;
00094 }

void View::CContractDialog::OnOK ( ) [protected, virtual]

Verify control's values and exit if all are valid

See also:
DoDataExchange

Definition at line 101 of file ContractDialog.cpp.

00102 {
00103     // data exchange
00104     UpdateData();
00105
00106     // validate m_strTitle
00107     if (m_strTitle.IsEmpty())
00108     {
00109         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00110         return;
00111     }
00112
00113     // validate m_strAuthor
00114     if (m_strAuthor.IsEmpty())
00115     {
00116         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00117         return;
00118     }
00119
00120     // validate m_strKey
00121     if (m_strKey.IsEmpty())
00122     {
00123         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00124         return;
00125     }
00126
00127     // validate m_strWording
00128     if (m_strWording.IsEmpty())
00129     {
00130         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00131         return;
00132     }
00133
00134     // validate m_nRegistrationNumber
00135     if (m_nRegistrationNumber <= 0)
00136     {
00137         AfxMessageBox("Bitte geben Sie eine positive Registeriernummer ein.");
00138         return;
00139     }
00140
00141     // done
00142     if (m_bModified)
00143         CDialog::OnOK();
00144     else
00145         CDialog::OnCancel();
00146 }

afx_msg void View::CContractDialog::OnChangea ( ) [protected]

Member Data Documentation

BOOL View::CContractDialog::m_bProved

Definition at line 35 of file ContractDialog.h.

BOOL View::CContractDialog::m_bSigned

Definition at line 38 of file ContractDialog.h.

CString View::CContractDialog::m_strAlterationDate

Definition at line 41 of file ContractDialog.h.

CString View::CContractDialog::m_strAuthor

Definition at line 44 of file ContractDialog.h.

CString View::CContractDialog::m_strDateOfFoundation

Definition at line 47 of file ContractDialog.h.

CString View::CContractDialog::m_strKey

Definition at line 50 of file ContractDialog.h.

int View::CContractDialog::m_nRegistrationNumber

Definition at line 53 of file ContractDialog.h.

CString View::CContractDialog::m_strTitle

Definition at line 56 of file ContractDialog.h.

CString View::CContractDialog::m_strWording

Definition at line 59 of file ContractDialog.h.

bool View::CContractDialog::m_bInitialize [protected]

Definition at line 74 of file ContractDialog.h.

bool View::CContractDialog::m_bModified [protected]

Definition at line 76 of file ContractDialog.h.

The documentation for this class was generated from the following files:
  • ContractDialog.h
  • ContractDialog.cpp


CDialog Class Reference

Inheritance diagram for CDialog::

Debug::CDumpDialog View::CAboutDialog View::CBankDocumentDialog View::CContractDialog View::CFolderDialog View::CFormDialog View::CStandingOrderDialog
The documentation for this class was generated from the following file:
  • ContractDialog.h


CDocument Class Reference

Inheritance diagram for CDocument::

Model::CPraktikumMFCDoc
The documentation for this class was generated from the following file:
  • PraktikumMFCDoc.h


Debug::CDumpDialog Class Reference

A modeless dialog that displays DEBUG output. More...

#include <DumpDialog.h>

Inheritance diagram for Debug::CDumpDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_DEBUG }

Public Methods

CDumpDialog (CWnd *pParent=NULL)
constructor. More...

Public Attributes

CString | m_strDump
BOOL | m_bObjectDump
BOOL | m_bParameterDump

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
virtual void | OnCancel ()
virtual void | OnOK ()
afx_msg void | OnButtonDelete ()
afx_msg void | OnCheckObjectdump ()
afx_msg void | OnCheckParameterdump ()
virtual BOOL | OnInitDialog ()

Detailed Description

Author:
Stephan Brumme
Date:
August 21, 2001
Invariant:
  • (none)

Definition at line 23 of file DumpDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 30 of file DumpDialog.h.

00030 { IDD = IDD_DEBUG };

Constructor & Destructor Documentation

Debug::CDumpDialog::CDumpDialog ( CWnd * pParent = NULL )

Initialize Dialog

Parameters:
pParent handle of the parent window (not used)

Definition at line 27 of file DumpDialog.cpp.

00028     : CDialog(CDumpDialog::IDD, pParent)
00029 {
00030     //{{AFX_DATA_INIT(CDumpDialog)
00031     m_strDump = _T("");
00032     m_bObjectDump = CTrace::m_bObjectDump;
00033     m_bParameterDump = CTrace::m_bParamDump;
00034     //}}AFX_DATA_INIT
00035 }

Member Function Documentation

void Debug::CDumpDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object

Definition at line 59 of file DumpDialog.cpp.

00060 {
00061     CDialog::DoDataExchange(pDX);
00062     //{{AFX_DATA_MAP(CDumpDialog)
00063     DDX_Text(pDX, IDC_EDIT_DUMP, m_strDump);
00064     DDX_Check(pDX, IDC_CHECK_OBJECTDUMP, m_bObjectDump);
00065     DDX_Check(pDX, IDC_CHECK_PARAMETERDUMP, m_bParameterDump);
00066     //}}AFX_DATA_MAP
00067 }

void Debug::CDumpDialog::OnCancel ( ) [protected, virtual]

Overridden to avoid closing the dialog

Definition at line 73 of file DumpDialog.cpp.

00074 {
00075 }

void Debug::CDumpDialog::OnOK ( ) [protected, virtual]

Save whole protocol to disc

Definition at line 81 of file DumpDialog.cpp.

00082 {
00083     // accepted file extensions
00084     const char strFilter[] = "Protokolldateien (*.log)|*.log|Alle Dateien (*.*)|*.*|";
00085     // "save" dialog
00086     CFileDialog dlg(FALSE, ".log", "*.log", NULL, strFilter, NULL);
00087
00088     if (dlg.DoModal() == IDOK)
00089     {
00090         // text file, overwrite if neccessary
00091         CStdioFile fFile(dlg.GetPathName(), CFile::modeCreate | CFile::modeWrite);
00092
00093         // windows-style CRLF
00094         CString strNoCRLF(m_strDump);
00095         strNoCRLF.Replace("\r", "");
00096
00097         // write it to disc
00098         fFile.WriteString(strNoCRLF);
00099
00100         // user feedback
00101         AfxMessageBox("Protokoll gespeichert.", MB_ICONINFORMATION);
00102     }
00103 }

void Debug::CDumpDialog::OnButtonDelete ( ) [protected]

Clear protocol

Definition at line 109 of file DumpDialog.cpp.

00110 {
00111     m_strDump = "";
00112     UpdateData(FALSE);
00113 }

void Debug::CDumpDialog::OnCheckObjectdump ( ) [protected]

Definition at line 116 of file DumpDialog.cpp.

00117 {
00118     UpdateData(TRUE);
00119     CTrace::m_bObjectDump = (m_bObjectDump == TRUE);
00120 }

void Debug::CDumpDialog::OnCheckParameterdump ( ) [protected]

Definition at line 122 of file DumpDialog.cpp.

00123 {
00124     UpdateData(TRUE);
00125     CTrace::m_bParamDump = (m_bParameterDump == TRUE);
00126 }

BOOL Debug::CDumpDialog::OnInitDialog ( ) [protected, virtual]

Set window style attributes (transparency)

Definition at line 41 of file DumpDialog.cpp.

00042 {
00043     CDialog::OnInitDialog();
00044
00045     // code taken from "Windows 2000 Systemprogrammierung" p. 87 by Ron Nanko
00046 //  SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
00047 //  SetLayeredWindowAttributes(m_hWnd, 0, (255*90)/100, LWA_ALPHA);
00048
00049     return TRUE;  // return TRUE unless you set the focus to a control
00050                   // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
00051 }

Member Data Documentation

CString Debug::CDumpDialog::m_strDump

Definition at line 32 of file DumpDialog.h.

BOOL Debug::CDumpDialog::m_bObjectDump

Definition at line 34 of file DumpDialog.h.

BOOL Debug::CDumpDialog::m_bParameterDump

Definition at line 36 of file DumpDialog.h.

The documentation for this class was generated from the following files:
  • DumpDialog.h
  • DumpDialog.cpp


CFile Class Reference

Inheritance diagram for CFile::

Debug::CFileTrace
The documentation for this class was generated from the following file:
  • FileTrace.h


Debug::CFileTrace Class Reference

CFileTrace is a CFile that "writes" to the trace window. More...

#include <FileTrace.h>

Inheritance diagram for Debug::CFileTrace::

CFile List of all members.

Static Public Methods

BOOL | Init ()
initialize this class as a singleton. More...

Private Methods

CFileTrace ()
default constructor. More...

virtual void | Write (const void *lpBuf, UINT nCount)
overwrite output writer. More...

Static Private Attributes

BOOL | autoInit = CFileTrace::Init()
true, if CFileTrace is successfully invoked. More...

Constructor & Destructor Documentation

Debug::CFileTrace::CFileTrace ( ) [private]

Set attributes

Definition at line 72 of file FileTrace.h.

00073 {
00074     // stream name
00075     m_strFileName = _T("CFileTrace");
00076     // no output function defined
00077     Print = NULL;
00078 }

Member Function Documentation

void Debug::CFileTrace::Write | ( | const void * | lpBuf,
 |  | UINT | nCount
 | ) | [private, virtual]

Override to write to debug window instead of file.

Parameters:
lpBuf | pointer to the debug output
nCount | number of bytes in lpBuf
See also:
CFile

Definition at line 86 of file FileTrace.h.

00087 {
00088     // MFC tracing not enabled ?
00089     if (!afxTraceEnabled)
00090         return;
00091
00092     // only redirect if user defined output function is defined
00093     if (Print)
00094     {
00095         static char mybuf[2048];
00096
00097         // copy buffer
00098         memcpy(mybuf, lpBuf, nCount);
00099
00100         // create a CString
00101         CString strDebug(mybuf, nCount);
00102         // and print it
00103         Print(strDebug);
00104     }
00105
00106     // Also do normal debug thing
00107     ::OutputDebugString((LPCTSTR)lpBuf);
00108 }

BOOL Debug::CFileTrace::Init ( ) [static]

Initialize tracing. Replace global afxDump.m_pFile with CFileTrace object.

Definition at line 114 of file FileTrace.h.

00115 {
00116     if (afxDump.m_pFile==NULL) {
00117         // Initialize tracing: replace afxDump.m_pFile w/ my own CFile object
00118         //
00119         // It's important to allocate with "new" here, not a static object,
00120         // because CFileTrace is virtual--i.e., called through a pointer in
00121         // the object's vtbl--and the compiler will zero out the virtual
00122         // function table with a NOP function when a static object
00123         // goes out of scope. But I want my CFileTrace to stay around to
00124         // display memory leak diagnostics even after all static objects
00125         // have been destructed. So I allocate the object with new and
00126         // never delete it. I don't want this allocation to itself generate
00127         // a reported memory leak, so I turn off memory tracking before I
00128         // allocate, then on again after.
00129         //
00130         BOOL bEnable = AfxEnableMemoryTracking(FALSE);
00131         afxDump.m_pFile = new CFileTrace;
00132         AfxEnableMemoryTracking(bEnable);
00133         return TRUE;
00134     }
00135     return FALSE;
00136 }

Member Data Documentation

BOOL Debug::CFileTrace::autoInit = CFileTrace::Init() [static, private]

Definition at line 151 of file FileTrace.h.

The documentation for this class was generated from the following file:
  • FileTrace.h


Model::CFolder Class Reference

A folder. More...

#include <Folder.h>

Inheritance diagram for Model::CFolder::

Model::CPolymorphicSet< CBankDocument > CObject List of all members.

Public Methods

CFolder ()
default constructor. More...

CFolder (const CFolder &folder)
copy constructor. More...

CFolder (CString strCustomerInformation)
explicitly set attributes. More...

virtual | ~CFolder ()
destructor. More...

virtual CObject * | Generate () const
create a new object. More...

virtual CObject * | GenerateC () const
clone this object. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate the form. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

virtual CFolder & | operator= (const CFolder &set)
copy the whole set. More...

virtual bool | operator== (const CFolder &set) const
compare two sets. More...

CMyDate | GetDateOfFoundation () const
get date of foundation. More...

CString | GetCustomerInformation () const
get customer information. More...

Private Attributes

CString | m_strCustomerInformation
customer information. More...

CMyDate m_dtDateOfFoundation
date of foundation. More...

Detailed Description

Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • date of foundation must be valid
  • customer information must be non-empty
  • parent class must be valid

Definition at line 27 of file Folder.h.

Constructor & Destructor Documentation

Model::CFolder::CFolder ( )

Default constructor

Definition at line 26 of file Folder.cpp.

Referenced by GenerateC().

00027 {
00028     m_strCustomerInformation = "(neu)";
00029 }

Model::CFolder::CFolder ( const CFolder & folder )

Copy constructor

Parameters:
folder CFolder to be copied

Definition at line 36 of file Folder.cpp.

00037 {
00038     operator=(folder);
00039 }

Model::CFolder::CFolder ( CString strCustomerInformation )

Initialize using customer information

Parameters:
strCustomerInformation customer information

Definition at line 46 of file Folder.cpp.

00047 {
00048     m_strCustomerInformation = strCustomerInformation;
00049 }

Model::CFolder::~CFolder ( ) [virtual]

Nothing left to do

Definition at line 55 of file Folder.cpp.

00056 {
00057 }

Member Function Documentation

CObject * Model::CFolder::Generate ( ) const [virtual]

Create a new non-initialized object

Returns:
new instance of CFolder

Definition at line 64 of file Folder.cpp.

00065 {
00066     return new CFolder;
00067 }

CObject * Model::CFolder::GenerateC ( ) const [virtual]

Clone this object

Returns:
exact copy

Definition at line 74 of file Folder.cpp.

00075 {
00076     return new CFolder(*this);
00077 }

void Model::CFolder::Serialize ( CArchive & ar ) [virtual]

Loads/stores CFolder

Parameters:
ar CArchive that provides data persistency

Reimplemented from Model::CPolymorphicSet.

Definition at line 84 of file Folder.cpp.

Referenced by Model::CPraktikumMFCDoc::Serialize().

00085 {
00086     // serialize parent
00087     CPolymorphicSet<CBankDocument>::Serialize(ar);
00088
00089
00090     if (ar.IsStoring())
00091         ar << m_strCustomerInformation;
00092     else
00093         ar >> m_strCustomerInformation;
00094
00095     m_dtDateOfFoundation.Serialize(ar);
00096 }

void Model::CFolder::AssertValid ( ) const [virtual]

Determines whether the foolder is valid, invariant describes further details (see above)

Reimplemented from Model::CPolymorphicSet.

Definition at line 103 of file Folder.cpp.

00104 {
00105     CPolymorphicSet<CBankDocument>::AssertValid();
00106
00107     ASSERT(!m_strCustomerInformation.IsEmpty());
00108     ASSERT_VALID(&m_dtDateOfFoundation);
00109 }

void Model::CFolder::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented from Model::CPolymorphicSet.

Definition at line 116 of file Folder.cpp.

00117 {
00118     CPolymorphicSet<CBankDocument>::Dump(dc);
00119
00120     dc << "customer information: " << m_strCustomerInformation << "\n"
00121        << "date of foundation: ";
00122
00123     m_dtDateOfFoundation.Dump(dc);
00124 }

CFolder & Model::CFolder::operator= ( const CFolder & set ) [virtual]

Copies all attributes

Parameters:
set set that will be copied
Returns:
reference to the current set

Definition at line 132 of file Folder.cpp.

Referenced by CFolder().

00133 {
00134     m_dtDateOfFoundation     = set.m_dtDateOfFoundation;
00135     m_strCustomerInformation = set.m_strCustomerInformation;
00136
00137     CPolymorphicSet<CBankDocument>::operator=(set);
00138
00139     return *this;
00140 }

bool Model::CFolder::operator== ( const CFolder & set ) const [virtual]

Compares all elements of two sets by value regardless their positions within the set. The cursors are not compared and may differ therefore

Parameters:
set set to compare to
Returns:
true, if both set are equal
Precondition:
parameter "set" must be valid

Definition at line 150 of file Folder.cpp.

00151 {
00152    return (CPolymorphicSet<CBankDocument>::operator==(set) &&
00153            m_strCustomerInformation == set.m_strCustomerInformation);
00154 }

CMyDate Model::CFolder::GetDateOfFoundation ( ) const

Get date of foundation

Returns:
date of foundation

Definition at line 161 of file Folder.cpp.

Referenced by Model::CPraktikumMFCDoc::ShowCustomerinformation().

00162 {
00163     return m_dtDateOfFoundation;
00164 }

CString Model::CFolder::GetCustomerInformation ( ) const

Get customer information

Returns:
customer information

Definition at line 171 of file Folder.cpp.

Referenced by Model::CPraktikumMFCDoc::ShowCustomerinformation().

00172 {
00173     return m_strCustomerInformation;
00174 }

Member Data Documentation

CString Model::CFolder::m_strCustomerInformation [private]

Definition at line 77 of file Folder.h.

CMyDate Model::CFolder::m_dtDateOfFoundation [private]

Definition at line 80 of file Folder.h.

The documentation for this class was generated from the following files:
  • Folder.h
  • Folder.cpp


View::CFolderDialog Class Reference

A dialog to create/display CFolder. More...

#include <FolderDialog.h>

Inheritance diagram for View::CFolderDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_FOLDER }
ID of the used dialog resource. More...

Public Methods

CFolderDialog (bool bInitialize=false, CWnd *pParent=NULL)
constructor. More...

Public Attributes

int | m_nCardinality
value of "cardinality" control. More...

CString | m_strCustomerInformation
value of "customer information" edit control. More...

CString | m_strDateOfFoundation
value of "date of foundation" control. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

virtual BOOL | OnInitDialog ()
initialize dialog controls. More...

virtual void | OnOK ()
validate controls and close dialog. More...

Protected Attributes

bool | m_bInitialize

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • customer information must be non-empty
  • invariant is verified by OnOK

Definition at line 23 of file FolderDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 31 of file FolderDialog.h.

00031 { IDD = IDD_FOLDER };

Constructor & Destructor Documentation

View::CFolderDialog::CFolderDialog | ( | bool | bInitialize = false,
 |  | CWnd * | pParent = NULL
 | ) |

Initialize all dialog controls and get dialog mode (create or display CFolder)

Parameters:
bInitialize | true, if used to create a new CFolder
pParent | handle of the parent window (not used)

Definition at line 26 of file FolderDialog.cpp.

00027     : CDialog(CFolderDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CFolderDialog)
00030     m_nCardinality = 0;
00031     m_strCustomerInformation = _T("");
00032     m_strDateOfFoundation = _T("");
00033     //}}AFX_DATA_INIT
00034
00035     m_bInitialize = bInitialize;
00036 }

Member Function Documentation

void View::CFolderDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object
See also:
OnOK

Definition at line 45 of file FolderDialog.cpp.

00046 {
00047     CDialog::DoDataExchange(pDX);
00048     //{{AFX_DATA_MAP(CFolderDialog)
00049     DDX_Text(pDX, IDC_EDIT_CARDINALITY, m_nCardinality);
00050     DDX_Text(pDX, IDC_EDIT_CUSTOMERINFORMATION, m_strCustomerInformation);
00051     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00052     //}}AFX_DATA_MAP
00053 }

BOOL View::CFolderDialog::OnInitDialog ( ) [protected, virtual]

Enable/disable dialog controls to differ between creation and display mode

See also:
CFolderDialog()

Definition at line 60 of file FolderDialog.cpp.

00061 {
00062     CDialog::OnInitDialog();
00063
00064     // controls are only writeable if used for construction of a new object
00065     if (m_bInitialize)
00066     {
00067         ((CEdit*)GetDlgItem(IDC_EDIT_CUSTOMERINFORMATION))->SetReadOnly(FALSE);
00068         ((CEdit*)GetDlgItem(IDC_EDIT_CUSTOMERINFORMATION))->SetFocus();
00069
00070         // disallow MFC to change the focus we set
00071         return FALSE;
00072     }
00073
00074     // done, MFC may automatically set focus according to tab order
00075     return TRUE;
00076 }

void View::CFolderDialog::OnOK ( ) [protected, virtual]

Verify control's values and exit if all are valid

See also:
DoDataExchange

Definition at line 83 of file FolderDialog.cpp.

00084 {
00085     // data exchange
00086     UpdateData();
00087
00088     // validate m_strCustomerInformation
00089     if (!m_strCustomerInformation.IsEmpty())
00090         CDialog::OnOK();
00091     else
00092         AfxMessageBox("Die Kundeninformation darf nicht leer sein.", MB_ICONSTOP);
00093 }

Member Data Documentation

int View::CFolderDialog::m_nCardinality

Definition at line 34 of file FolderDialog.h.

CString View::CFolderDialog::m_strCustomerInformation

Definition at line 37 of file FolderDialog.h.

CString View::CFolderDialog::m_strDateOfFoundation

Definition at line 40 of file FolderDialog.h.

bool View::CFolderDialog::m_bInitialize [protected]

Definition at line 53 of file FolderDialog.h.

The documentation for this class was generated from the following files:
  • FolderDialog.h
  • FolderDialog.cpp


Model::CForm Class Reference

A form. More...

#include <Form.h>

Inheritance diagram for Model::CForm::

Model::CBankDocument CObject Model::CStandingOrder List of all members.

Public Methods

CForm ()
default constructor. More...

CForm (const CForm &form)
copy constructor. More...

CForm (CString strAuthor, CString strTitle, CString strKey, bool bProved, bool bSigned, CString strFormality)
explicitly set attributes. More...

virtual | ~CForm ()
destructor. More...

virtual CObject * | Generate () const
create a new object. More...

virtual CObject * | GenerateC () const
clone this object. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate the form. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

CForm & | operator= (const CForm &form)
copy. More...

virtual CBankDocument & | operator= (const CBankDocument &bankdocument)
polymorphic copy. More...

bool | operator== (const CForm &form) const
comparison. More...

virtual bool | operator== (const CBankDocument &bankdocument) const
polymorphic comparison. More...

virtual CString | KeyOf () const
deliver a unique identifier. More...

bool | GetProved () const
determine whether form is proved. More...

bool | GetSigned () const
determine whether form is signed. More...

CString | GetFormality () const
get formality. More...

CMyDate | GetAlterationDate () const
get alteration date. More...

void | SetProved (bool bProved)
set "proved" property. More...

void | SetSigned (bool bSigned)
set "signed" property. More...

Protected Methods

void | HasChanged ()
at least one attribute has changed. More...

Private Attributes

bool | m_bProved
form is proved. More...

bool | m_bSigned
form is signed. More...

CString | m_strFormality
formality. More...

CMyDate m_dtAlterationDate
alteration date. More...

Detailed Description

Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • m_strFormality must be non-empty
  • m_dtAlterationDate must be valid
  • parent class must be valid

Definition at line 26 of file Form.h.

Constructor & Destructor Documentation

Model::CForm::CForm ( )

Constructs a new unproved and unsigned form

Definition at line 24 of file Form.cpp.

Referenced by GenerateC().

00025 {
00026     m_bProved = m_bSigned = false;
00027 }

Model::CForm::CForm ( const CForm & form )

Copies an existing CForm

Parameters:
form form to be copied
See also:
operator=

Definition at line 35 of file Form.cpp.

00036 {
00037     operator=(form);
00038 }

Model::CForm::CForm | ( | CString | strAuthor,
 |  | CString | strTitle,
 |  | CString | strKey,
 |  | bool | bProved,
 |  | bool | bSigned,
 |  | CString | strFormality
 | ) |

Constructs a new form using given attributes

Parameters:
strAuthor | author
strTitle | title
strKey | key
bProved | is it proved ?
bSigned | is it signed ?
strFormality | formality

Definition at line 50 of file Form.cpp.

00052      : CBankDocument(strAuthor, strTitle, strKey)
00053 {
00054     m_bProved = bProved;
00055     m_bSigned = bSigned;
00056
00057     m_strFormality = strFormality;
00058     HasChanged();
00059 }

Model::CForm::~CForm ( ) [virtual]

No clean-up required

Definition at line 65 of file Form.cpp.

00066 {
00067 }

Member Function Documentation

CObject * Model::CForm::Generate ( ) const [virtual]

Create a new non-initialized object

Returns:
new instance of CForm

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 74 of file Form.cpp.

00075 {
00076     return new CForm;
00077 }

CObject * Model::CForm::GenerateC ( ) const [virtual]

Clone this object

Returns:
exact copy

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 84 of file Form.cpp.

00085 {
00086     return new CForm(*this);
00087 }

void Model::CForm::Serialize ( CArchive & ar ) [virtual]

Loads/stores CForm

Parameters:
ar CArchive that provides data persistency

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 94 of file Form.cpp.

00095 {
00096     // serialize parent
00097     CBankDocument::Serialize(ar);
00098
00099     // CArchive can't handle "bool" so I have to use "BOOL" (which is "int" ...)
00100     BOOL bProved = m_bProved,
00101          bSigned = m_bSigned;
00102
00103     if (ar.IsStoring())
00104         ar << bProved << bSigned << m_strFormality;
00105     else
00106         ar >> bProved >> bSigned >> m_strFormality;
00107
00108     // neccessary because of MFC's "bool!=BOOL story"
00109     m_bProved = (bProved == TRUE);
00110     m_bSigned = (bSigned == TRUE);
00111
00112     // << and >> operators are not overloaded
00113     m_dtAlterationDate.Serialize(ar);
00114 }

void Model::CForm::AssertValid ( ) const [virtual]

Determines whether the form is valid, invariant describes further details (see above)

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 121 of file Form.cpp.

00122 {
00123     CBankDocument::AssertValid();
00124
00125     ASSERT(!m_strFormality.IsEmpty());
00126     ASSERT_VALID(&m_dtAlterationDate);
00127 }

void Model::CForm::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 134 of file Form.cpp.

Referenced by operator=(), and operator==().

00135 {
00136     CBankDocument::Dump(dc);
00137
00138     dc << "\n"
00139        << "proved: " << m_bProved << "\n"
00140        << "signed: " << m_bSigned << "\n"
00141        << "formality: " << m_strFormality << "\n"
00142        << "alternation date: ";
00143
00144     m_dtAlterationDate.Dump(dc);
00145 }

CForm & Model::CForm::operator= ( const CForm & form )

Copies all attributes for polymorphic behaviour

Parameters:
form CForm that should be copied
Returns:
reference to the copied form

Definition at line 153 of file Form.cpp.

Referenced by CForm(), and operator=().

00154 {
00155     // copy inherited attributes
00156     CBankDocument::operator =(form);
00157
00158     // copy CForm's attributes
00159     m_bProved = form.m_bProved;
00160     m_bSigned = form.m_bSigned;
00161     m_dtAlterationDate = form.m_dtAlterationDate;
00162     m_strFormality     = form.m_strFormality;
00163
00164     return *this;
00165 }

CBankDocument & Model::CForm::operator= ( const CBankDocument & bankdocument ) [virtual]

Copies all attributes for polymorphic behaviour

Parameters:
bankdocument CForm (casted as CBankDocument) that should be copied
Returns:
reference to the copied form

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 173 of file Form.cpp.

00174 {
00175     try
00176     {
00177         // copy all attributes
00178         operator =(dynamic_cast<const CForm&>(bankdocument));
00179     }
00180     catch(...)
00181     {
00182         // invalid class
00183 #ifdef _DEBUG
00184         TRACE("Copy denied because of invalid cast (needed a CForm)\n");
00185         Dump(afxDump);
00186         bankdocument.Dump(afxDump);
00187 #endif
00188     }
00189
00190     return *this;
00191 }

bool Model::CForm::operator== ( const CForm & form ) const

Compare attributes (except key) of two forms

Parameters:
form CForm that we compare to
Returns:
true, if all attributes are equal

Definition at line 199 of file Form.cpp.

Referenced by operator==().

00200 {
00201     return (CBankDocument::operator ==(form) &&
00202             m_bProved == form.m_bProved &&
00203             m_bSigned == form.m_bSigned &&
00204 //            m_dtAlterationDate == form.m_dtAlterationDate &&
00205             m_strFormality     == form.m_strFormality);
00206 }

bool Model::CForm::operator== ( const CBankDocument & bankdocument ) const [virtual]

Compares all attributes for polymorphic behaviour

Parameters:
bankdocument CForm (casted as CBankDocument) that should be compared to
Returns:
true, if all attributes are equal

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 214 of file Form.cpp.

00215 {
00216     try
00217     {
00218         // compare all attributes
00219         return operator ==(dynamic_cast<const CForm&>(bankdocument));
00220     }
00221     catch(...)
00222     {
00223         // invalid class
00224         TRACE("Comparison denied because of invalid cast\n"
00225               "(needed a CForm and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00226 #ifdef _DEBUG
00227         Dump(afxDump);
00228         bankdocument.Dump(afxDump);
00229 #endif
00230     }
00231
00232     return false;
00233 }

CString Model::CForm::KeyOf ( ) const [virtual]

Responsible for the generation of a unique key based on the object's attributes

Returns:
CString that contains the key

Reimplemented from Model::CBankDocument.

Reimplemented in Model::CStandingOrder.

Definition at line 240 of file Form.cpp.

00241 {
00242     CString strKey;
00243     strKey.Format("[%s|%d|%d|%s|%s|%p]", m_strFormality, m_bProved,  m_bSigned,
00244                                          m_dtAlterationDate.KeyOf(),
00245                                          CBankDocument::KeyOf(),
00246                                          this);
00247     return strKey;
00248 }

bool Model::CForm::GetProved ( ) const

Get "proved" property

Returns:
true, if form is proved

Definition at line 255 of file Form.cpp.

00256 {
00257     return m_bProved;
00258 }

bool Model::CForm::GetSigned ( ) const

Get "signed" property

Returns:
true, if form is signed

Definition at line 263 of file Form.cpp.

00264 {
00265     return m_bSigned;
00266 }

CString Model::CForm::GetFormality ( ) const

Get formality

Returns:
formality

Definition at line 271 of file Form.cpp.

00272 {
00273     return m_strFormality;
00274 }

CMyDate Model::CForm::GetAlterationDate ( ) const

Get alteration date

Returns:
alteration date

Definition at line 279 of file Form.cpp.

00280 {
00281     return m_dtAlterationDate;
00282 }

void Model::CForm::SetProved ( bool bProved )

Set "proved" property

Parameters:
bProved true, if form is proved

Definition at line 289 of file Form.cpp.

00290 {
00291     m_bProved = bProved;
00292     // update alteration date
00293     HasChanged();
00294 }

void Model::CForm::SetSigned ( bool bSigned )

Set "signed" property

Parameters:
bSigned true, if form is signed

Definition at line 299 of file Form.cpp.

00300 {
00301     m_bSigned = bSigned;
00302     // update alteration date
00303     HasChanged();
00304 }

void Model::CForm::HasChanged ( ) [protected]

Update date of alteration

Definition at line 310 of file Form.cpp.

Referenced by Model::CStandingOrder::SetAmount(), Model::CStandingOrder::SetInterval(), SetProved(), and SetSigned().

00311 {
00312     m_dtAlterationDate = CMyDate();
00313 }

Member Data Documentation

bool Model::CForm::m_bProved [private]

Definition at line 105 of file Form.h.

bool Model::CForm::m_bSigned [private]

Definition at line 108 of file Form.h.

CString Model::CForm::m_strFormality [private]

Definition at line 111 of file Form.h.

CMyDate Model::CForm::m_dtAlterationDate [private]

Definition at line 114 of file Form.h.

The documentation for this class was generated from the following files:
  • Form.h
  • Form.cpp


View::CFormDialog Class Reference

A dialog to create/edit CForm. More...

#include <FormDialog.h>

Inheritance diagram for View::CFormDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_FORM }
ID of the used dialog resource. More...

Public Methods

CFormDialog (bool bInitialize=false, CWnd *pParent=NULL)
constructor. More...

Public Attributes

CString | m_strAuthor
value of "author" edit control. More...

CString | m_strDateOfFoundation
value of "date of foundation" control. More...

CString | m_strKey
value of "key" edit control. More...

CString | m_strTitle
value of "title" edit control. More...

CString | m_strFormality
value of "formality" edit control. More...

CString | m_strAlterationDate
value of "alteration date" control. More...

BOOL | m_bProved
value of "proved" checkbox control. More...

BOOL | m_bSigned
value of "signed" checkbox control. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

void | OnChange ()
virtual BOOL | OnInitDialog ()
initialize dialog controls. More...

virtual void | OnOK ()
validate controls and close dialog. More...

Protected Attributes

bool | m_bInitialize
true, if used to construct a new CForm (enable more controls). More...

bool | m_bModified

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • each CString attribute must be non-empty
  • invariant is verified by OnOK

Definition at line 23 of file FormDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 31 of file FormDialog.h.

00031 { IDD = IDD_FORM };

Constructor & Destructor Documentation

View::CFormDialog::CFormDialog | ( | bool | bInitialize = false,
 |  | CWnd * | pParent = NULL
 | ) |

Initialize all dialog controls and get dialog mode (create or edit CForm)

Parameters:
bInitialize | true, if used to create a new CForm
pParent | handle of the parent window (not used)

Definition at line 27 of file FormDialog.cpp.

00028     : CDialog(CFormDialog::IDD, pParent)
00029 {
00030     //{{AFX_DATA_INIT(CFormDialog)
00031     m_strAuthor = _T("");
00032     m_strDateOfFoundation = _T("");
00033     m_strKey = _T("");
00034     m_strTitle = _T("");
00035     m_strFormality = _T("");
00036     m_strAlterationDate = _T("");
00037     m_bProved = FALSE;
00038     m_bSigned = FALSE;
00039     //}}AFX_DATA_INIT
00040
00041     m_bInitialize = bInitialize;
00042     m_bModified   = false;
00043 }

Member Function Documentation

void View::CFormDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object
See also:
OnOK

Definition at line 52 of file FormDialog.cpp.

00053 {
00054     CDialog::DoDataExchange(pDX);
00055     //{{AFX_DATA_MAP(CFormDialog)
00056     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00057     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00058     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00059     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00060     DDX_Text(pDX, IDC_EDIT_FORMALITY, m_strFormality);
00061     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00062     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00063     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00064     //}}AFX_DATA_MAP
00065 }

void View::CFormDialog::OnChange ( ) [protected]

Definition at line 143 of file FormDialog.cpp.

00144 {
00145     m_bModified = true;
00146 }

BOOL View::CFormDialog::OnInitDialog ( ) [protected, virtual]

Enable/disable dialog controls to differ between creation and edit mode

See also:
CFormDialog()

Definition at line 72 of file FormDialog.cpp.

00073 {
00074     CDialog::OnInitDialog();
00075
00076     InitializeFlatSB      (GetDlgItem(IDC_EDIT_FORMALITY)->m_hWnd);
00077     FlatSB_EnableScrollBar(GetDlgItem(IDC_EDIT_FORMALITY)->m_hWnd, SB_VERT, 0);
00078
00079     // controls are only writeable if used for construction of a new object
00080     if (m_bInitialize)
00081     {
00082         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00083         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00084         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00085         ((CEdit*)GetDlgItem(IDC_EDIT_FORMALITY))->SetReadOnly(FALSE);
00086
00087         // set cursor to title edit control
00088         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00089
00090         // disallow MFC to change the focus we set
00091         return FALSE;
00092     }
00093
00094     // done, MFC may automatically set focus according to tab order
00095     return TRUE;
00096 }

void View::CFormDialog::OnOK ( ) [protected, virtual]

Verify control's values and exit if all are valid

See also:
DoDataExchange

Definition at line 103 of file FormDialog.cpp.

00104 {
00105     // data exchange
00106     UpdateData();
00107
00108     // validate m_strTitle
00109     if (m_strTitle.IsEmpty())
00110     {
00111         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00112         return;
00113     }
00114
00115     // validate m_strAuthor
00116     if (m_strAuthor.IsEmpty())
00117     {
00118         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00119         return;
00120     }
00121
00122     // validate m_strKey
00123     if (m_strKey.IsEmpty())
00124     {
00125         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00126         return;
00127     }
00128
00129     // validate m_strFormality
00130     if (m_strFormality.IsEmpty())
00131     {
00132         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00133         return;
00134     }
00135
00136     // done
00137     if (m_bModified)
00138         CDialog::OnOK();
00139     else
00140         CDialog::OnCancel();
00141 }

Member Data Documentation

CString View::CFormDialog::m_strAuthor

Definition at line 34 of file FormDialog.h.

CString View::CFormDialog::m_strDateOfFoundation

Definition at line 37 of file FormDialog.h.

CString View::CFormDialog::m_strKey

Definition at line 40 of file FormDialog.h.

CString View::CFormDialog::m_strTitle

Definition at line 43 of file FormDialog.h.

CString View::CFormDialog::m_strFormality

Definition at line 46 of file FormDialog.h.

CString View::CFormDialog::m_strAlterationDate

Definition at line 49 of file FormDialog.h.

BOOL View::CFormDialog::m_bProved

Definition at line 52 of file FormDialog.h.

BOOL View::CFormDialog::m_bSigned

Definition at line 55 of file FormDialog.h.

bool View::CFormDialog::m_bInitialize [protected]

Definition at line 70 of file FormDialog.h.

bool View::CFormDialog::m_bModified [protected]

Definition at line 72 of file FormDialog.h.

The documentation for this class was generated from the following files:
  • FormDialog.h
  • FormDialog.cpp


CListView Class Reference

Inheritance diagram for CListView::

View::CPraktikumMFCView
The documentation for this class was generated from the following file:
  • PraktikumMFCView.h


Controller::CMainFrame Class Reference

The MDI main frame. More...

#include <MainFrm.h>

Inheritance diagram for Controller::CMainFrame::

CMDIFrameWnd List of all members.

Public Methods

CMainFrame ()
default constructor. More...

virtual BOOL PreCreateWindow (CREATESTRUCT &cs)

Detailed Description

Author:
Visual Studio Wizard
Date:
August 4, 2001

Definition at line 23 of file MainFrm.h.

Constructor & Destructor Documentation

Controller::CMainFrame::CMainFrame ( ) [inline]

Definition at line 28 of file MainFrm.h.

00028 {};

Member Function Documentation

BOOL Controller::CMainFrame::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Change visual appearance, remove file name from window title

Parameters:
cs Windows style
Returns:
true, if successful

Definition at line 27 of file MainFrm.cpp.

00028 {
00029     if( !CMDIFrameWnd::PreCreateWindow(cs) )
00030         return FALSE;
00031
00032     cs.style &= ~ FWS_ADDTOTITLE;
00033     cs.style |= FWS_PREFIXTITLE;
00034
00035     return TRUE;
00036 }

The documentation for this class was generated from the following files:
  • MainFrm.h
  • MainFrm.cpp


CMDIChildWnd Class Reference

Inheritance diagram for CMDIChildWnd::

Controller::CChildFrame
The documentation for this class was generated from the following file:
  • ChildFrm.h


CMDIFrameWnd Class Reference

Inheritance diagram for CMDIFrameWnd::

Controller::CMainFrame
The documentation for this class was generated from the following file:
  • MainFrm.h


CMyDate Class Reference

Stores date and time. More...

#include <MyDate.h>

Inheritance diagram for CMyDate::

CObject List of all members.

Public Types

enum {
JANUARY = 1, FEBRUARY = 2, MARCH = 3, APRIL = 4,
MAY = 5, JUNE = 6, JULY = 7, AUGUST = 8,
SEPTEMBER = 9, OCTOBER = 10, NOVEMBER = 11, DECEMBER = 12
}
constants for month's names. More...

Public Methods

CMyDate ()
default constructor. More...

CMyDate (const CMyDate &date)
copy constructor. More...

CMyDate (unsigned int nDay, unsigned int nMonth, unsigned int nYear, unsigned int nHour=0, unsigned int nMinute=0, unsigned int nSecond=0)
set user defined date at construction time. More...

virtual | ~CMyDate ()
destructor. More...

void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

virtual CMyDate & | operator= (const CMyDate &date)
copy. More...

virtual CMyDate & | operator= (const CTime &time)
to enhance compatibility to CTime. More...

virtual bool | operator== (const CMyDate &date) const
compare two dates. More...

virtual | operator CTime () const
convert to MFC's CTime. More...

virtual | operator CString () const
formatted string representation. More...

virtual CString | Format (CString strFormat) const
formatted string representation. More...

virtual CString | KeyOf () const
generate a key. More...

void | SetDay (unsigned int nDay)
set day. More...

void | SetMonth (unsigned int nMonth)
set month. More...

void | SetYear (unsigned int nYear)
set year. More...

void | SetHour (unsigned int nHour)
set hour. More...

void | SetMinute (unsigned int nMinute)
set minute. More...

void | SetSecond (unsigned int nSecond)
set second. More...

unsigned int | GetDay () const
return day. More...

unsigned int | GetMonth () const
return month. More...

unsigned int | GetYear () const
return year. More...

unsigned int | GetHour () const
return hour. More...

unsigned int | GetMinute () const
return minute. More...

unsigned int | GetSecond () const
return second. More...

Static Public Methods

void | GetCurrent (unsigned int &nDay, unsigned int &nMonth, unsigned int &nYear, unsigned int &nHour, unsigned int &nMinute, unsigned int &nSecond)
return current date and time. More...

bool | IsLeapYear (unsigned int nYear)
true, if it is a leap year. More...

Private Attributes

unsigned int | m_nDay
day. More...

unsigned int | m_nMonth
month. More...

unsigned int | m_nYear
year. More...

unsigned int | m_nHour
hour. More...

unsigned int | m_nMinute
minute. More...

unsigned int | m_nSecond
second. More...

Detailed Description

  • 24h-based, no AM/PM support
  • interface inspired by MFC's CTime
  • conversion operator for CTime overloaded
Author:
Stephan Brumme
Date:
August 5, 2001
Invariant:
  • restricted to the usual Gregorian calender (recognizes leap years)

Definition at line 25 of file MyDate.h.

Member Enumeration Documentation

anonymous enum

The constants were defined for better readability and aren't urgently required

Enumeration values:
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER

Definition at line 126 of file MyDate.h.

00126          { JANUARY   =  1, FEBRUARY =  2, MARCH    =  3, APRIL    =  4,
00127            MAY       =  5, JUNE     =  6, JULY     =  7, AUGUST   =  8,
00128            SEPTEMBER =  9, OCTOBER  = 10, NOVEMBER = 11, DECEMBER = 12 };

Constructor & Destructor Documentation

CMyDate::CMyDate ( )

Constructs a new object that contains current date and time

See also:
GetCurrent

Definition at line 25 of file MyDate.cpp.

00026 {
00027     GetCurrent(m_nDay, m_nMonth, m_nYear, m_nHour, m_nMinute, m_nSecond);
00028 }

CMyDate::CMyDate ( const CMyDate & date )

Copies an existing CMyDate

Parameters:
date date to be copied
See also:
operator=

Definition at line 36 of file MyDate.cpp.

00037 {
00038     operator=(date);
00039 }

CMyDate::CMyDate | ( | unsigned int | nDay,
 |  | unsigned int | nMonth,
 |  | unsigned int | nYear,
 |  | unsigned int | nHour = 0,
 |  | unsigned int | nMinute = 0,
 |  | unsigned int | nSecond = 0
 | ) |

Constructs a new CMyDate using given date/time

Parameters:
nDay | day
nMonth | month
nYear | year
nHour | hour
nMinute | minute
nSecond | second

Definition at line 51 of file MyDate.cpp.

00053 {
00054     // store date
00055     m_nDay    = nDay;
00056     m_nMonth  = nMonth;
00057     m_nYear   = nYear;
00058
00059     // store time
00060     m_nHour   = nHour;
00061     m_nMinute = nMinute;
00062     m_nSecond = nSecond;
00063 }

CMyDate::~CMyDate ( ) [virtual]

No deeper meaning right now

Definition at line 69 of file MyDate.cpp.

00070 {
00071 }

Member Function Documentation

void CMyDate::Serialize ( CArchive & ar )

Loads/stores CMyDate

Parameters:
ar CArchive that provides data persistency

Definition at line 78 of file MyDate.cpp.

Referenced by Model::CForm::Serialize(), Model::CFolder::Serialize(), Model::CContract::Serialize(), and Model::CBankDocument::Serialize().

00079 {
00080     // do not forget to serialize CObject's data members
00081     CObject::Serialize(ar);
00082
00083     if (ar.IsStoring())
00084         ar << m_nYear << m_nMonth << m_nDay << m_nHour << m_nMinute << m_nSecond;
00085     else
00086         ar >> m_nYear >> m_nMonth >> m_nDay >> m_nHour >> m_nMinute >> m_nSecond;
00087 }

void CMyDate::AssertValid ( ) const [virtual]

Determines whether the date is valid, invariant describes further details (see above)

Definition at line 94 of file MyDate.cpp.

00095 {
00096     CObject::AssertValid();
00097
00098     // validate month
00099     ASSERT(m_nMonth >= JANUARY && m_nMonth <= DECEMBER);
00100
00101     // days per month, february may vary, note that array starts with 0 (JANUARY=1 !)
00102     unsigned int nDaysPerMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
00103
00104     // adjust days of february
00105     if (IsLeapYear(m_nYear))
00106         nDaysPerMonth[FEBRUARY]++;
00107
00108     // validate day
00109     ASSERT(m_nDay > 0 && m_nDay <= nDaysPerMonth[m_nMonth]);
00110     // day and month are valid
00111
00112     // now check the time
00113     ASSERT(m_nHour   >= 0 && m_nHour   <= 23);
00114     ASSERT(m_nMinute >= 0 && m_nMinute <= 59);
00115     ASSERT(m_nSecond >= 0 && m_nSecond <= 59);
00116 }

void CMyDate::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Definition at line 123 of file MyDate.cpp.

Referenced by Model::CForm::Dump(), Model::CFolder::Dump(), Model::CContract::Dump(), and Model::CBankDocument::Dump().

00124 {
00125     CObject::Dump(dc);
00126
00127     CString strOutput;
00128     strOutput.Format("%02d.%02d.%04d - %02d:%02d:%02d",
00129                       m_nDay, m_nMonth, m_nYear, m_nHour, m_nMinute, m_nSecond);
00130     dc << strOutput;
00131 }

void CMyDate::GetCurrent | ( | unsigned int & | nDay,
 |  | unsigned int & | nMonth,
 |  | unsigned int & | nYear,
 |  | unsigned int & | nHour,
 |  | unsigned int & | nMinute,
 |  | unsigned int & | nSecond
 | ) | [static]

Static method that returns current date/time

Definition at line 137 of file MyDate.cpp.

Referenced by CMyDate().

00139 {
00140     // the following code is basically taken from MSDN
00141
00142     // use system functions to get the current date as UTC
00143     time_t secondsSince1970;
00144     time(&secondsSince1970);
00145
00146     // convert UTC to local time zone
00147     struct tm *localTime;
00148     localTime = localtime(&secondsSince1970);
00149
00150     // store retrieved date
00151     nDay    = localTime->tm_mday;
00152     nMonth  = localTime->tm_mon + 1;
00153     nYear   = localTime->tm_year + 1900;
00154     // store time
00155     nHour   = localTime->tm_hour;
00156     nMinute = localTime->tm_min;
00157     nSecond = localTime->tm_sec;
00158 }

bool CMyDate::IsLeapYear ( unsigned int nYear ) [static]

Static method to determine whether it is a leap year

Parameters:
nYear year to examine
Returns:
true, if nYear is a leap year

Definition at line 166 of file MyDate.cpp.

Referenced by AssertValid().

00167 {
00168     // used to speed up code, may be deleted
00169     if (nYear % 4   != 0)
00170         return false;
00171
00172     // algorithm taken from MSDN, just converted from VBA to C++
00173     if (nYear % 400 == 0)
00174         return true;
00175     if (nYear % 100 == 0)
00176         return false;
00177     if (nYear % 4   == 0)
00178         return true;
00179
00180     // this line won't be executed because of optimization (see above)
00181     return false;
00182 }

CMyDate & CMyDate::operator= ( const CMyDate & date ) [virtual]

Copies all attributes

Parameters:
date CMyDate that should be copied
Returns:
reference to the copied date
See also:
CMyDate(const CMyDate& date) , Copy , operator=(const CTime &time)

Definition at line 193 of file MyDate.cpp.

Referenced by CMyDate().

00194 {
00195     // date
00196     m_nDay    = date.m_nDay;
00197     m_nMonth  = date.m_nMonth;
00198     m_nYear   = date.m_nYear;
00199     // time
00200     m_nHour   = date.m_nHour;
00201     m_nMinute = date.m_nMinute;
00202     m_nSecond = date.m_nSecond;
00203
00204     return *this;
00205 }

CMyDate & CMyDate::operator= ( const CTime & time ) [virtual]

Copies date/time specific attributes of MFC's CTime

Parameters:
time CTime that should be copied
Returns:
reference to the copied date
See also:
CMyDate(const CMyDate& date) , operator=(const CMyDate &date)

Definition at line 215 of file MyDate.cpp.

00216 {
00217     // date
00218     m_nDay    = time.GetDay();
00219     m_nMonth  = time.GetMonth();
00220     m_nYear   = time.GetYear();
00221     // time
00222     m_nHour   = time.GetHour();
00223     m_nMinute = time.GetMinute();
00224     m_nSecond = time.GetSecond();
00225
00226     return *this;
00227 }

bool CMyDate::operator== ( const CMyDate & date ) const [virtual]

Compare attributes of two dates

Parameters:
date CMyDate that we compare to
Returns:
true, if all attributes are equal

Definition at line 235 of file MyDate.cpp.

00236 {
00237     // compare date and time attributes
00238     return (m_nDay    == date.m_nDay    &&
00239             m_nMonth  == date.m_nMonth  &&
00240             m_nYear   == date.m_nYear   &&
00241             m_nHour   == date.m_nHour   &&
00242             m_nMinute == date.m_nMinute &&
00243             m_nSecond == date.m_nSecond);
00244 }

CMyDate::operator CTime ( ) const [virtual]

Overloaded convertion operator for CTime

Returns:
CMyDate that is casted to CTime

Definition at line 251 of file MyDate.cpp.

00252 {
00253     return CTime(m_nYear, m_nMonth, m_nDay, m_nHour, m_nMinute, m_nSecond);
00254 }

CMyDate::operator CString ( ) const [virtual]

Overloaded convertion operator for CString

Returns:
CMyDate that is casted to CString
See also:
Format

Definition at line 262 of file MyDate.cpp.

00263 {
00264     return Format("%A, %d.%B %Y, %H:%M:%S");
00265 }

CString CMyDate::Format ( CString strFormat ) const [virtual]

Definition at line 272 of file MyDate.cpp.

Referenced by Model::CPraktikumMFCDoc::ShowCustomerinformation(), and operator CString().

00273 {
00274     return CTime(*this).Format(strFormat);
00275 }

CString CMyDate::KeyOf ( ) const [virtual]

Responsible for the generation of a unique key based on the object's attributes

Returns:
CString that contains the key

Definition at line 282 of file MyDate.cpp.

Referenced by Model::CForm::KeyOf(), Model::CContract::KeyOf(), and Model::CBankDocument::KeyOf().

00283 {
00284     CString strKey;
00285     strKey.Format("[%d|%d|%d|%d|%d|%d|%p]", m_nDay,  m_nMonth,  m_nYear,
00286                                             m_nHour, m_nMinute, m_nSecond,
00287                                             this);
00288     return strKey;
00289 }

void CMyDate::SetDay ( unsigned int nDay )

Set day

Parameters:
nDay day

Definition at line 296 of file MyDate.cpp.

00297 {
00298     m_nDay = nDay;
00299 }

void CMyDate::SetMonth ( unsigned int nMonth )

Set month

Parameters:
nMonth month

Definition at line 304 of file MyDate.cpp.

00305 {
00306     m_nMonth = nMonth;
00307 }

void CMyDate::SetYear ( unsigned int nYear )

Set year

Parameters:
nYear year

Definition at line 312 of file MyDate.cpp.

00313 {
00314     m_nYear = nYear;
00315 }

void CMyDate::SetHour ( unsigned int nHour )

Set hour

Parameters:
nHour hour

Definition at line 320 of file MyDate.cpp.

00321 {
00322     m_nHour = nHour;
00323 }

void CMyDate::SetMinute ( unsigned int nMinute )

Set minute

Parameters:
nMinute minute

Definition at line 328 of file MyDate.cpp.

00329 {
00330     m_nMinute = nMinute;
00331 }

void CMyDate::SetSecond ( unsigned int nSecond )

Set second

Parameters:
nSecond second

Definition at line 336 of file MyDate.cpp.

00337 {
00338     m_nSecond = nSecond;
00339 }

unsigned int CMyDate::GetDay ( ) const

Get day

Returns:
day

Definition at line 345 of file MyDate.cpp.

00346 {
00347     return m_nDay;
00348 }

unsigned int CMyDate::GetMonth ( ) const

Get month

Returns:
month

Definition at line 353 of file MyDate.cpp.

00354 {
00355     return m_nMonth;
00356 }

unsigned int CMyDate::GetYear ( ) const

Get year

Returns:
year

Definition at line 361 of file MyDate.cpp.

00362 {
00363     return m_nYear;
00364 }

unsigned int CMyDate::GetHour ( ) const

Get hour

Returns:
hour

Definition at line 369 of file MyDate.cpp.

00370 {
00371     return m_nHour;
00372 }

unsigned int CMyDate::GetMinute ( ) const

Get minute

Returns:
minute

Definition at line 377 of file MyDate.cpp.

00378 {
00379     return m_nMinute;
00380 }

unsigned int CMyDate::GetSecond ( ) const

Get second

Returns:
second

Definition at line 385 of file MyDate.cpp.

00386 {
00387     return m_nSecond;
00388 }

Member Data Documentation

unsigned int CMyDate::m_nDay [private]

Definition at line 133 of file MyDate.h.

unsigned int CMyDate::m_nMonth [private]

Definition at line 136 of file MyDate.h.

unsigned int CMyDate::m_nYear [private]

Definition at line 139 of file MyDate.h.

unsigned int CMyDate::m_nHour [private]

Definition at line 143 of file MyDate.h.

unsigned int CMyDate::m_nMinute [private]

Definition at line 146 of file MyDate.h.

unsigned int CMyDate::m_nSecond [private]

Definition at line 149 of file MyDate.h.

The documentation for this class was generated from the following files:
  • MyDate.h
  • MyDate.cpp


CObject Class Reference

Inheritance diagram for CObject::

CMyDate Model::CBankDocument Model::CPolymorphicSet Model::CPolymorphicSet< CBankDocument > Model::CContract Model::CForm Model::CFolder Model::CStandingOrder
The documentation for this class was generated from the following file:
  • PolymorphicSet.h


TemplateModel::CPolymorphicSet class Reference

Model::CPolymorphicSet Class Template Reference

Template of a polymorphic set. More...

#include <PolymorphicSet.h>

Inheritance diagram for Model::CPolymorphicSet::

CObject List of all members.

Public Methods

CPolymorphicSet ()
default constructor. More...

CPolymorphicSet (const CPolymorphicSet< C > &set)
copy constructor. More...

virtual | ~CPolymorphicSet ()
destructor. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
invariance. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

virtual CPolymorphicSet< C > & | operator= (const CPolymorphicSet< C > &set)
copy the whole set. More...

virtual bool | operator== (const CPolymorphicSet< C > &set) const
compare two sets value identity. More...

bool | Equal (const CPolymorphicSet< C > *set) const
object identity. More...

int | Card () const
returns number of stored elements. More...

C * | GetFirst ()
first stored element. More...

C * | GetNext ()
next element. More...

C * | GetCurrent () const
gets the element the cursor points to. More...

void | SetCursor (int nIndex)
set the cursor to the element specified by an index. More...

int | Insert (const C *element)
inserts an element. More...

void | Scratch ()
deletes current element. More...

void | ScratchAll ()
deletes the whole set. More...

bool | Find (const C *element)
finds an element. More...

Protected Methods

C * | Clone (const C *element) const
creates a new instance and copies all attributes. More...

Protected Attributes

CList< C *, C *> | m_Set
stores all elements in a list. More...

POSITION | m_Cursor
cursor, may be altered at any time. More...

Detailed Description

template<class C>
class Model::CPolymorphicSet< C >

  • The only parameter is the base class of all elements (at least CObject)
  • All elements are copied by the interface methods to avoid unexpected behaviour (e.g. external deletion)
  • fully serializable
Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • If the set is empty then m_Cursor must be NULL else it must point to a element
  • No element is allowed to appear more than once

Definition at line 40 of file PolymorphicSet.h.

Constructor & Destructor Documentation

template<class C>
Model::CPolymorphicSet< C >::CPolymorphicSet ( )

Constructs an empty set

Definition at line 109 of file PolymorphicSet.h.

00110 {
00111     // empty set
00112     m_Cursor = NULL;
00113 }

template<class C>
Model::CPolymorphicSet< C >::CPolymorphicSet ( const CPolymorphicSet< C > & set )

Copies an existing set

Parameters:
set reference to the set that should be copied
See also:
operator=

Definition at line 121 of file PolymorphicSet.h.

00122 {
00123     operator=(set);
00124 }

template<class C>
Model::CPolymorphicSet< C >::~CPolymorphicSet ( ) [virtual]

Cleans up memory

See also:
ScratchAll

Definition at line 131 of file PolymorphicSet.h.

00132 {
00133     ScratchAll();
00134 }

Member Function Documentation

template<class C>
void Model::CPolymorphicSet< C >::Serialize ( CArchive & ar ) [virtual]

Loads / stores the set

Parameters:
ar CArchive that provides access to the file system

Reimplemented in Model::CFolder.

Definition at line 141 of file PolymorphicSet.h.

00142 {
00143     CTrace trace("Serialize",this);
00144
00145     // do not forget to serialize CObject's data members
00146     CObject::Serialize(ar);
00147
00148     // make use of CArchive's overloaded << and >> operators for *CObject
00149
00150     if (ar.IsStoring())
00151     {
00152         // save polymorphic set
00153
00154         // write cardinality
00155         ar << m_Set.GetCount();
00156
00157         // write all elements
00158         POSITION pos     = m_Set.GetHeadPosition();
00159         int nCursorIndex = 0,
00160             nCount       = 0;
00161         while (pos != NULL)
00162         {
00163             // get cursor index
00164             if (m_Cursor == pos)
00165                 nCursorIndex = nCount;
00166             nCount++;
00167
00168             ar << m_Set.GetNext(pos);
00169         }
00170
00171         // store cursor index
00172         ar << nCursorIndex;
00173     }
00174     else
00175     {
00176         // load polymorphic set
00177
00178         // first, delete old set
00179         ScratchAll();
00180
00181         int nCount;
00182         // load cardinality
00183         ar >> nCount;
00184         // load all elements
00185         for (int i=0; i<nCount; i++)
00186         {
00187             C* element;
00188             ar >> element;
00189             m_Set.AddTail(element);
00190         }
00191
00192         // get cursor index
00193         int nCursorIndex;
00194         ar >> nCursorIndex;
00195         // create cursor out of the index
00196         m_Cursor = m_Set.FindIndex(nCursorIndex);
00197     }
00198 }

template<class C>
void Model::CPolymorphicSet< C >::AssertValid ( ) const [virtual]

Determines whether the set is valid, invariant describes further details (see above)

Reimplemented in Model::CFolder.

Definition at line 204 of file PolymorphicSet.h.

00205 {
00206     CObject::AssertValid();
00207
00208     // if the set is empty then cursor must be NULL
00209     if (m_Set.IsEmpty())
00210     {
00211         ASSERT(m_Cursor == NULL);
00212         return;
00213     }
00214
00215     CString strClassName = GetRuntimeClass()->m_lpszClassName;
00216
00217     // each element may be present in set at most once
00218     // cursor must point to an element (or NULL)
00219     POSITION pos = m_Set.GetHeadPosition();
00220     bool bValidCursor = false;
00221     if (m_Cursor == NULL)
00222         bValidCursor = true;
00223
00224     while (pos != NULL)
00225     {
00226         // element that the cursor points to was found ?
00227         if (pos == m_Cursor)
00228             bValidCursor = true;
00229
00230         // get element
00231         C* element = m_Set.GetNext(pos);
00232         POSITION posfind = pos;
00233         // compare to the remaining elements
00234         while (posfind != NULL)
00235         {
00236             C* compare = m_Set.GetNext(posfind);
00237             // no two equal elements are allowed
00238
00239             // same class ?
00240             if (strClassName == compare->GetRuntimeClass()->m_lpszClassName)
00241                 // equal values ?
00242                 ASSERT(!(*element == *compare));
00243         }
00244     }
00245
00246     // cursor successfully validated ?
00247     ASSERT(bValidCursor);
00248 }

template<class C>
void Model::CPolymorphicSet< C >::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented in Model::CFolder.

Definition at line 255 of file PolymorphicSet.h.

00256 {
00257     CObject::Dump(dc);
00258
00259     // some general infos
00260     dc << Card() << " elements, cursor points to " << m_Cursor << "\n"
00261        << "// the following elements are separated by a line (----------)\n";
00262
00263     // dump all elements
00264     POSITION pos = m_Set.GetHeadPosition();
00265     while (pos != NULL)
00266     {
00267         m_Set.GetNext(pos)->Dump(dc);
00268         dc << "\n----------\n";
00269     }
00270 }

template<class C>
CPolymorphicSet< C > & Model::CPolymorphicSet< C >::operator= ( const CPolymorphicSet< C > & set ) [virtual]

Copies all attributes with respect to cloning all elements and adjusting the cursor

Parameters:
set set that will be copied
Returns:
reference to the current set
See also:
CPolymorphicSet(const CPolymorphicSet<C>& set)

Definition at line 279 of file PolymorphicSet.h.

Referenced by CPolymorphicSet().

00280 {
00281     CTrace trace("operator=",this,&set);
00282
00283     // delete old elements
00284     ScratchAll();
00285
00286     POSITION pos = set.m_Set.GetHeadPosition();
00287     while (pos != NULL)
00288     {
00289         // save current position
00290         POSITION cursor = pos;
00291
00292         // clone each element
00293         C* element = set.m_Set.GetNext(pos);
00294         C* copy    = Clone(element);
00295         m_Set.AddTail(copy);
00296
00297         // set cursor
00298         // we can't use set.m_Cursor directly because we copied all elements
00299         // and therefore lost their old memory address
00300         if (cursor == set.m_Cursor)
00301             m_Cursor = m_Set.GetTailPosition();
00302     }
00303
00304     return *this;
00305 }

template<class C>
bool Model::CPolymorphicSet< C >::operator== ( const CPolymorphicSet< C > & set ) const [virtual]

Compares all elements of two sets by value regardless their positions within the set. The cursors are not compared and may differ therefore

Parameters:
set set to compare to
Returns:
true, if both set are equal
Precondition:
parameter "set" must be valid

Definition at line 315 of file PolymorphicSet.h.

00316 {
00317     CTrace trace("operator==",this,&set);
00318
00319     ASSERT_VALID(&set);
00320
00321     // same number of elements is required
00322     if (m_Set.GetCount() != set.m_Set.GetCount())
00323         return false;
00324
00325     // each element of this set must be found in the other set
00326     POSITION pos = m_Set.GetHeadPosition();
00327     while (pos != NULL)
00328     {
00329         C* element = m_Set.GetNext(pos);
00330         if (set.m_Set.Find(element))
00331             return false;
00332     }
00333
00334     // all elements were found, sets must be equal
00335     return true;
00336 }

template<class C>
bool Model::CPolymorphicSet< C >::Equal ( const CPolymorphicSet< C > * set ) const

Check whether two to sets are not only equal but also identical

Parameters:
set set to compare to
Returns:
true, if both sets are identical

Definition at line 344 of file PolymorphicSet.h.

00345 {
00346     CTrace trace("Equal",this,set);
00347
00348     return (set == this);
00349 }

template<class C>
int Model::CPolymorphicSet< C >::Card ( ) const

Determine the size of the polymorphic set

Returns:
number of stored elements

Definition at line 356 of file PolymorphicSet.h.

Referenced by Dump().

00357 {
00358     CTrace trace("Card",this);
00359
00360     return m_Set.GetCount();
00361 }

template<class C>
C * Model::CPolymorphicSet< C >::GetFirst ( )

Set cursor to the first element and return a copy of it

Returns:
copy of the first element
See also:
GetNext, GetCurrent
Precondition:
set must be non-empty

Definition at line 370 of file PolymorphicSet.h.

00371 {
00372     CTrace trace("GetFirst",this);
00373
00374     // set must not be empty
00375     ASSERT(!m_Set.IsEmpty());
00376
00377     // set cursor
00378     m_Cursor = m_Set.GetHeadPosition();
00379
00380     // generate copy
00381     C* copy = Clone(m_Set.GetHead());
00382     return copy;
00383 }

template<class C>
C * Model::CPolymorphicSet< C >::GetNext ( )

Iterate cursor to the next element and return a copy of it

Returns:
copy of the next element
See also:
GetFirst, GetCurrent
Precondition:
set must be non-empty and cursor must be valid

Definition at line 392 of file PolymorphicSet.h.

Referenced by operator=().

00393 {
00394     CTrace trace("GetNext",this);
00395
00396     // set must not be empty
00397     ASSERT(!m_Set.IsEmpty());
00398     // cursor must not be at the end of the set
00399     ASSERT(m_Cursor != NULL);
00400
00401     // set cursor
00402     m_Set.GetNext(m_Cursor);
00403
00404     // generate copy
00405     C* copy = Clone(m_Set.GetAt(m_Cursor));
00406     return copy;
00407 }

template<class C>
C * Model::CPolymorphicSet< C >::GetCurrent ( ) const

Return a copy of the element the cursor points to

Returns:
copy of the current element
See also:
GetFirst, GetNext
Precondition:
cursor must be valid

Definition at line 416 of file PolymorphicSet.h.

00417 {
00418     CTrace trace("GetCurrent",this);
00419
00420     // cursor must not be at the end of the set
00421     ASSERT(m_Cursor != NULL);
00422
00423     // generate copy
00424     C* copy = Clone(m_Set.GetAt(m_Cursor));
00425     return copy;
00426 }

template<class C>
void Model::CPolymorphicSet< C >::SetCursor ( int nIndex )

Set the cursor to an element specified by an index

Parameters:
nIndex zero-based index

Definition at line 433 of file PolymorphicSet.h.

00434 {
00435     CTrace trace("SetCursor",this);
00436
00437     m_Cursor = m_Set.FindIndex(nIndex);
00438 }

template<class C>
int Model::CPolymorphicSet< C >::Insert ( const C * element )

Insert a new element into the set and return its position

Parameters:
element element to be inserted
Returns:
zero-based index, -1 if failed (element already exists)
See also:
Clone

Definition at line 447 of file PolymorphicSet.h.

00448 {
00449     CTrace trace("Insert",this,element);
00450
00451     // don't insert an object twice
00452     if (Find(element))
00453         return -1;
00454
00455     // add a copy to our set, change cursor
00456     m_Cursor = m_Set.AddTail(Clone(element));
00457
00458     // return index in the set
00459     return m_Set.GetCount()-1;
00460 }

template<class C>
void Model::CPolymorphicSet< C >::Scratch ( )

Delete the element the cursor currently points to and adjust cursor

See also:
ScratchAll
Precondition:
cursor must be valid (and the set non-empty)

Definition at line 468 of file PolymorphicSet.h.

00469 {
00470     CTrace trace("Scratch",this);
00471
00472     // cursor must not be at the end of the set
00473     ASSERT(m_Cursor != NULL);
00474
00475     // store current cursor
00476     POSITION removepos = m_Cursor;
00477     // go on to the next element (else we lose it after erasing this element)
00478     m_Set.GetNext(m_Cursor);
00479
00480     // remove element that the cursor previously pointed to
00481     delete m_Set.GetAt(removepos);
00482     m_Set.RemoveAt(removepos);
00483 }

template<class C>
void Model::CPolymorphicSet< C >::ScratchAll ( )

Delete the whole set including all stored elements

See also:
Scratch

Definition at line 490 of file PolymorphicSet.h.

Referenced by Serialize(), operator=(), and ~CPolymorphicSet().

00491 {
00492     CTrace trace("ScratchAll",this);
00493
00494     // front to back
00495     while (!m_Set.IsEmpty())
00496     {
00497         // delete element
00498         delete m_Set.GetHead();
00499         // remove the correspending pointer from the set
00500         m_Set.RemoveHead();
00501     }
00502
00503     // reset cursor
00504     m_Cursor = NULL;
00505 }

template<class C>
bool Model::CPolymorphicSet< C >::Find ( const C * element )

Search through the whole set and set m_Cursor if found

Parameters:
element element to look for
Returns:
true, if element was found

Definition at line 513 of file PolymorphicSet.h.

Referenced by Insert(), and operator==().

00514 {
00515     CTrace trace("Find",this,element);
00516
00517     // only non-empty sets
00518     if (m_Set.IsEmpty())
00519         return false;
00520
00521     CString strClassName = element->GetRuntimeClass()->m_lpszClassName;
00522
00523     // iterate through the whole list
00524     POSITION pos = m_Set.GetHeadPosition();
00525     while (pos != NULL)
00526     {
00527         // store position in case we find a match
00528         POSITION storepos = pos;
00529
00530         // get an element we compare to
00531         C* compare  = m_Set.GetNext(pos);
00532
00533         // same class ?
00534         if (strClassName == compare->GetRuntimeClass()->m_lpszClassName)
00535             // equal values ?
00536             if (*element == *compare)
00537             {
00538                 // yes, set cursor and return "success !"
00539                 m_Cursor = storepos;
00540                 return true;
00541             }
00542     }
00543
00544     // element is not part of the set
00545     return false;
00546 }

template<class C>
C * Model::CPolymorphicSet< C >::Clone ( const C * element ) const [protected]

Copy an object using MFC's own RTTI mechanismus to prevent polymorphism

Parameters:
element element to be cloned
Returns:
copy of element

Definition at line 554 of file PolymorphicSet.h.

Referenced by GetCurrent(), GetFirst(), GetNext(), Insert(), and operator=().

00555 {
00556     CTrace trace("Clone",this,element);
00557
00558     // create new instance (care for correct class !)
00559     C* copy = static_cast<C*>(element->GetRuntimeClass()->CreateObject());
00560     // copy attributes
00561     *copy = *element;
00562
00563     return copy;
00564 }

Member Data Documentation

template<class C>
CList<C*, C*> Model::CPolymorphicSet::m_Set [protected]

Definition at line 94 of file PolymorphicSet.h.

template<class C>
POSITION Model::CPolymorphicSet::m_Cursor [protected]

Definition at line 97 of file PolymorphicSet.h.

The documentation for this class was generated from the following file:
  • PolymorphicSet.h


Application::CPraktikumMFCApp Class Reference

The main class. More...

#include <PraktikumMFC.h>

Inheritance diagram for Application::CPraktikumMFCApp::

CWinApp List of all members.

Public Methods

CPraktikumMFCApp ()
default constructor. More...

~CPraktikumMFCApp ()
virtual BOOL | InitInstance ()
initialize application (e.g. get settings). More...

afx_msg void | OnAppAbout ()
display some general info. More...

afx_msg void | OnHelp ()
start help system. More...

afx_msg void | OnWWW ()
go to http://www.stephan-brumme.com/. More...

afx_msg void | OnShowDebug ()
show debug dialog. More...

Static Public Methods

void | AddDebug (const char *strText)
bool | IsDebug ()
true, if debug dialog is visible. More...

Static Private Attributes

CDumpDialog * | m_pDumpDialog = NULL

Detailed Description

  • main class for the whole application
  • to be used as a singleton
Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • (none)

Definition at line 40 of file PraktikumMFC.h.

Constructor & Destructor Documentation

Application::CPraktikumMFCApp::CPraktikumMFCApp ( )

Nothing left to do

See also:
InitInstance

Definition at line 47 of file PraktikumMFC.cpp.

00048 {
00049 #ifdef _DEBUG
00050     Debug::Print = AddDebug;
00051     m_pDumpDialog = new CDumpDialog;
00052 #endif
00053 }

Application::CPraktikumMFCApp::~CPraktikumMFCApp ( )

Definition at line 56 of file PraktikumMFC.cpp.

00057 {
00058     if (m_pDumpDialog != NULL)
00059     {
00060         m_pDumpDialog->DestroyWindow();
00061         delete m_pDumpDialog;
00062     }
00063 }

Member Function Documentation

BOOL Application::CPraktikumMFCApp::InitInstance ( ) [virtual]

Initialize application

Returns:
true, if successful

Definition at line 70 of file PraktikumMFC.cpp.

00071 {
00072     // use German settings
00073     setlocale(LC_ALL, "German");
00074
00075 #ifdef _AFXDLL
00076     // shared MFC-DLL
00077     Enable3dControls();
00078 #else
00079     // statically linked MFC
00080     Enable3dControlsStatic();
00081 #endif
00082
00083     // registry key that stores the program's settings
00084     SetRegistryKey(_T("PraktikumMFC Stephan Brumme"));
00085
00086     // load program's settings
00087     LoadStdProfileSettings();
00088
00089     // register document templates
00090     CMultiDocTemplate* pDocTemplate;
00091     pDocTemplate = new CMultiDocTemplate(
00092         IDR_PRAKTITYPE,
00093         RUNTIME_CLASS(CPraktikumMFCDoc),
00094         RUNTIME_CLASS(CChildFrame),
00095         RUNTIME_CLASS(CPraktikumMFCView));
00096     AddDocTemplate(pDocTemplate);
00097
00098
00099     // build main MDI frame window
00100     CMainFrame* pMainFrame = new CMainFrame;
00101     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
00102         return FALSE;
00103     m_pMainWnd = pMainFrame;
00104
00105     // parse command line
00106     CCommandLineInfo cmdInfo;
00107     ParseCommandLine(cmdInfo);
00108
00109     // don't create a new file on start-up time
00110     if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
00111         cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
00112
00113     if (!ProcessShellCommand(cmdInfo))
00114         return FALSE;
00115
00116     // show debug window
00117     if (m_pDumpDialog)
00118     {
00119         m_pDumpDialog->Create(IDD_DEBUG);
00120         m_pDumpDialog->ShowWindow(SW_SHOW);
00121     }
00122
00123     // open new main window
00124     pMainFrame->ShowWindow(m_nCmdShow);
00125     pMainFrame->UpdateWindow();
00126
00127     // done
00128     return TRUE;
00129 }

void Application::CPraktikumMFCApp::OnAppAbout ( )

Display some general info

See also:
CAboutDialog

Definition at line 136 of file PraktikumMFC.cpp.

00137 {
00138     View::CAboutDialog dlg;
00139     dlg.DoModal();
00140 }

void Application::CPraktikumMFCApp::OnHelp ( )

Start CHM help system using Windows shell

Definition at line 146 of file PraktikumMFC.cpp.

00147 {
00148     ShellExecute(NULL, "open", "PraktikumMFC.chm", NULL, NULL, SW_SHOWNORMAL);
00149 }

void Application::CPraktikumMFCApp::OnWWW ( )

Open web browser (http://www.stephan-brumme.com) using Windows shell

Definition at line 155 of file PraktikumMFC.cpp.

00156 {
00157     ShellExecute(NULL, "open", "http://www.stephan-brumme.com/", NULL, NULL, SW_SHOWNORMAL);
00158 }

void Application::CPraktikumMFCApp::OnShowDebug ( )

Show object dump

Definition at line 164 of file PraktikumMFC.cpp.

00165 {
00166 #ifdef _DEBUG
00167 #else
00168     AfxMessageBox("Debuginformationen nicht verfügbar.", MB_ICONSTOP);
00169 #endif
00170 }

void Application::CPraktikumMFCApp::AddDebug ( const char * strText ) [static]

Definition at line 173 of file PraktikumMFC.cpp.

00174 {
00175 #ifdef _DEBUG
00176     if (IsDebug())
00177     {
00178         m_pDumpDialog->m_strDump += strText;
00179         m_pDumpDialog->m_strDump.Replace("\r\n", "\n");
00180         m_pDumpDialog->m_strDump.Replace("\n", "\r\n");
00181         m_pDumpDialog->UpdateData(FALSE);
00182     }
00183 #endif
00184 }

bool Application::CPraktikumMFCApp::IsDebug ( ) [static]

Definition at line 187 of file PraktikumMFC.cpp.

Referenced by AddDebug().

00188 {
00189     return (m_pDumpDialog != NULL);
00190 }

Member Data Documentation

CDumpDialog * Application::CPraktikumMFCApp::m_pDumpDialog = NULL [static, private]

Definition at line 44 of file PraktikumMFC.cpp.

The documentation for this class was generated from the following files:
  • PraktikumMFC.h
  • PraktikumMFC.cpp


Model::CPraktikumMFCDoc Class Reference

The main document. More...

#include <PraktikumMFCDoc.h>

Inheritance diagram for Model::CPraktikumMFCDoc::

CDocument List of all members.

Public Methods

virtual BOOL | OnNewDocument ()
create a new document. More...

virtual void | Serialize (CArchive &ar)
serialize the folder. More...

virtual void | DeleteContents ()
delete the folder's content. More...

void | EditEntry (int nEntry)
edit a folder's element. More...

void | InsertBankdocument ()
insert a new bank document. More...

void | InsertForm ()
insert a new form. More...

void | InsertStandingorder ()
insert a new standing order. More...

void | InsertContract ()
insert a new contract. More...

void | DeleteAll ()
delete all elements. More...

void | DeleteEntry (int nEntry)
delete a single element. More...

void | ShowCustomerinformation () const
show folder's properties. More...

Public Attributes

Model::CFolder m_Folder
one and only data member. More...

Protected Methods

CPraktikumMFCDoc ()
default constructor. More...

~CPraktikumMFCDoc ()
destructor. More...

Detailed Description

  • document of the application
Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • (none)

Definition at line 26 of file PraktikumMFCDoc.h.

Constructor & Destructor Documentation

Model::CPraktikumMFCDoc::CPraktikumMFCDoc ( ) [protected]

No debug dialog on startup

Definition at line 39 of file PraktikumMFCDoc.cpp.

00040 {
00041 }

Model::CPraktikumMFCDoc::~CPraktikumMFCDoc ( ) [protected]

Definition at line 44 of file PraktikumMFCDoc.cpp.

00045 {
00046 }

Member Function Documentation

BOOL Model::CPraktikumMFCDoc::OnNewDocument ( ) [virtual]

Ask for folder's properties

Returns:
true, if successful
See also:
CFolderDialog
Invariant:
see CFolderDialog

Definition at line 55 of file PraktikumMFCDoc.cpp.

00056 {
00057     // the usual stuff
00058     if (!CDocument::OnNewDocument())
00059         return FALSE;
00060
00061     // ask for customer information
00062     View::CFolderDialog dlg(true);
00063     dlg.m_strDateOfFoundation = "(noch nicht angelegt)";
00064     if (dlg.DoModal() == IDOK)
00065     {
00066         // OK pressed, so create a new one
00067         CFolder myFolder(dlg.m_strCustomerInformation);
00068         m_Folder = myFolder;
00069         return TRUE;
00070     }
00071     else
00072         // cancel
00073         return FALSE;
00074 }

void Model::CPraktikumMFCDoc::Serialize ( CArchive & ar ) [virtual]

Load/store the document

Parameters:
ar CArchive to be used
See also:
CFolder::Serialize

Definition at line 82 of file PraktikumMFCDoc.cpp.

00083 {
00084     m_Folder.Serialize(ar);
00085
00086     UpdateAllViews(NULL);
00087 }

void Model::CPraktikumMFCDoc::DeleteContents ( ) [virtual]

Reset folder's set

Definition at line 93 of file PraktikumMFCDoc.cpp.

00094 {
00095     // delete all elements in the set
00096     m_Folder.ScratchAll();
00097
00098     CDocument::DeleteContents();
00099     UpdateAllViews(NULL);
00100 }

void Model::CPraktikumMFCDoc::EditEntry ( int nEntry )

Edit a folder's element, care for polymorphic behaviour of the set

Parameters:
nEntry index of the edited element
See also:
CBankDocument, CForm, CStandingOrder, CContract, CBankDocumentDialog, CFormDialog, CStandingOrderDialog, CContractDialog, CObject::IsKindOf

Definition at line 238 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnDblclk(), and View::CPraktikumMFCView::OnShowCursor().

00239 {
00240     // move cursor to the selected element
00241     m_Folder.SetCursor(nEntry);
00242     // get it
00243     CBankDocument* pObject = m_Folder.GetCurrent();
00244
00245     // IsKindOf is true, if class(a)=class(b) AND if class(a)=derived from class(b)
00246     // therefore, we have to look for derived classes first
00247
00248     // CContract ?
00249     if (pObject->IsKindOf(RUNTIME_CLASS(CContract)))
00250     {
00251         CContract* pContract = static_cast<CContract*>(pObject);
00252
00253         // fill in dialog's controls
00254         View::CContractDialog dlg;
00255         dlg.m_strDateOfFoundation = pContract->GetDateOfFoundation();
00256         dlg.m_strAlterationDate   = pContract->GetAlterationDate();
00257         dlg.m_strWording          = pContract->GetWording();
00258         dlg.m_nRegistrationNumber = pContract->GetRegistrationNumber();
00259         dlg.m_strAuthor = pContract->GetAuthor();
00260         dlg.m_strKey    = pContract->GetKey();
00261         dlg.m_strTitle  = pContract->GetTitle();
00262         dlg.m_bProved   = pContract->GetProved();
00263         dlg.m_bSigned   = pContract->GetSigned();
00264
00265         // only update if user pressed OK
00266         if (dlg.DoModal() == IDOK)
00267         {
00268             pContract->SetSigned(dlg.m_bProved != 0);
00269             pContract->SetProved(dlg.m_bSigned != 0);
00270             pContract->SetWording(dlg.m_strWording);
00271
00272             // delete old entry
00273             m_Folder.Scratch();
00274             // add the updated one
00275             m_Folder.Insert(pContract);
00276
00277             SetModifiedFlag();
00278         }
00279     }
00280     else
00281     // CStandingOrder ?
00282     if (pObject->IsKindOf(RUNTIME_CLASS(CStandingOrder)))
00283     {
00284         CStandingOrder* pOrder = static_cast<CStandingOrder*>(pObject);
00285
00286         // fill in dialog's controls
00287         View::CStandingOrderDialog dlg;
00288         dlg.m_strDateOfFoundation = pOrder->GetDateOfFoundation();
00289         dlg.m_strAlterationDate   = pOrder->GetAlterationDate();
00290         dlg.m_strFormality        = pOrder->GetFormality();
00291         dlg.m_strAuthor = pOrder->GetAuthor();
00292         dlg.m_strKey    = pOrder->GetKey();
00293         dlg.m_strTitle  = pOrder->GetTitle();
00294         dlg.m_bProved   = pOrder->GetProved();
00295         dlg.m_bSigned   = pOrder->GetSigned();
00296         dlg.m_nAmount   = pOrder->GetAmount();
00297         dlg.m_nInterval = pOrder->GetInterval();
00298         dlg.m_strSource = pOrder->GetSource();
00299         dlg.m_strRecipient = pOrder->GetRecipient();
00300         dlg.m_strSubject   = pOrder->GetSubject();
00301
00302         // only update if user pressed OK
00303         if (dlg.DoModal() == IDOK)
00304         {
00305             pOrder->SetSigned(dlg.m_bProved != 0);
00306             pOrder->SetProved(dlg.m_bSigned != 0);
00307             pOrder->SetAmount(dlg.m_nAmount);
00308             pOrder->SetInterval(dlg.m_nInterval);
00309
00310             // delete old entry
00311             m_Folder.Scratch();
00312             // add the updated one
00313             m_Folder.Insert(pOrder);
00314
00315             SetModifiedFlag();
00316         }
00317     }
00318     else
00319     // CForm ?
00320     if (pObject->IsKindOf(RUNTIME_CLASS(CForm)))
00321     {
00322         CForm* pForm = static_cast<CForm*>(pObject);
00323
00324         // fill in dialog's controls
00325         View::CFormDialog dlg;
00326         dlg.m_strDateOfFoundation = pForm->GetDateOfFoundation();
00327         dlg.m_strAlterationDate   = pForm->GetAlterationDate();
00328         dlg.m_strFormality        = pForm->GetFormality();
00329         dlg.m_strAuthor = pForm->GetAuthor();
00330         dlg.m_strKey    = pForm->GetKey();
00331         dlg.m_strTitle  = pForm->GetTitle();
00332         dlg.m_bProved   = pForm->GetProved();
00333         dlg.m_bSigned   = pForm->GetSigned();
00334
00335         // only update if user pressed OK
00336         if (dlg.DoModal() == IDOK)
00337         {
00338             pForm->SetSigned(dlg.m_bProved != 0);
00339             pForm->SetProved(dlg.m_bSigned != 0);
00340
00341             // delete old entry
00342             m_Folder.Scratch();
00343             // add the updated one
00344             m_Folder.Insert(pForm);
00345
00346             SetModifiedFlag();
00347         }
00348     }
00349     else
00350     // CBankDocument ?
00351     if (pObject->IsKindOf(RUNTIME_CLASS(CBankDocument)))
00352     {
00353         // fill in dialog's controls
00354         View::CBankDocumentDialog dlg;
00355         dlg.m_strAuthor = pObject->GetAuthor();
00356         dlg.m_strDateOfFoundation = pObject->GetDateOfFoundation();
00357         dlg.m_strKey    = pObject->GetKey();
00358         dlg.m_strTitle  = pObject->GetTitle();
00359
00360         // show dialog
00361         dlg.DoModal();
00362     }
00363     else
00364         // RTTI failed
00365         TRACE("Cannot identify class %s.\n", pObject->GetRuntimeClass()->m_lpszClassName);
00366
00367     // delete the copy
00368     delete pObject;
00369     UpdateAllViews(NULL);
00370 }

void Model::CPraktikumMFCDoc::InsertBankdocument ( )

Insert a new bank document

See also:
CBankDocument, CBankDocumentDialog
Invariant:
see CBankDocumentDialog

Definition at line 124 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnInsertBankdocument().

00125 {
00126     // dialog is used for construction
00127     View::CBankDocumentDialog dlg(true);
00128
00129     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00130
00131     if (dlg.DoModal() == IDOK)
00132     {
00133         CBankDocument bankdocument(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey);
00134         m_Folder.Insert(&bankdocument);
00135     }
00136
00137     UpdateAllViews(NULL);
00138 }

void Model::CPraktikumMFCDoc::InsertForm ( )

Insert a new form

See also:
CForm, CFormDialog
Invariant:
see CFormDialog

Definition at line 146 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnInsertForm().

00147 {
00148     // dialog is used for construction
00149     View::CFormDialog dlg(true);
00150
00151     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00152     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00153     dlg.m_bProved = dlg.m_bSigned = FALSE;
00154
00155     if (dlg.DoModal() == IDOK)
00156     {
00157         // convert BOOL to bool
00158         bool bProved = (dlg.m_bProved != 0);
00159         bool bSigned = (dlg.m_bSigned != 0);
00160
00161         CForm form(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00162                    bProved, bSigned, dlg.m_strFormality);
00163         m_Folder.Insert(&form);
00164     }
00165
00166     UpdateAllViews(NULL);
00167 }

void Model::CPraktikumMFCDoc::InsertStandingorder ( )

Insert a new standing order

See also:
CStandingOrder, CStandingOrderDialog
Invariant:
see CStandingOrderDialog

Definition at line 175 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnInsertStandingorder().

00176 {
00177     // dialog is used for construction
00178     View::CStandingOrderDialog dlg(true);
00179
00180     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00181     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00182     dlg.m_bProved = dlg.m_bSigned = FALSE;
00183     dlg.m_nAmount = dlg.m_nInterval = 0;
00184
00185     if (dlg.DoModal() == IDOK)
00186     {
00187         // convert BOOL to bool
00188         bool bProved = (dlg.m_bProved != 0);
00189         bool bSigned = (dlg.m_bSigned != 0);
00190
00191         CStandingOrder order(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00192                              bProved, bSigned, dlg.m_strFormality,
00193                              dlg.m_nAmount, dlg.m_strSubject, dlg.m_strSource,
00194                              dlg.m_strRecipient, dlg.m_nInterval);
00195         m_Folder.Insert(&order);
00196     }
00197
00198     UpdateAllViews(NULL);
00199 }

void Model::CPraktikumMFCDoc::InsertContract ( )

Insert a new contract

See also:
CContract, CContractDialog
Invariant:
see CContractDialog

Definition at line 207 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnInsertContract().

00208 {
00209     // dialog is used for construction
00210     View::CContractDialog dlg(true);
00211
00212     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00213     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00214     dlg.m_bProved = dlg.m_bSigned = FALSE;
00215
00216     if (dlg.DoModal() == IDOK)
00217     {
00218         // convert BOOL to bool
00219         bool bProved = (dlg.m_bProved != 0);
00220         bool bSigned = (dlg.m_bSigned != 0);
00221
00222         CContract contract(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00223                            dlg.m_nRegistrationNumber, bProved, bSigned, dlg.m_strWording);
00224         m_Folder.Insert(&contract);
00225     }
00226
00227     UpdateAllViews(NULL);
00228 }

void Model::CPraktikumMFCDoc::DeleteAll ( )

Delete the whole folder

Definition at line 376 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnDeleteAll().

00377 {
00378     m_Folder.ScratchAll();
00379     UpdateAllViews(NULL);
00380 }

void Model::CPraktikumMFCDoc::DeleteEntry ( int nEntry )

Delete current element

Parameters:
nEntry index of the selected element

Definition at line 387 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnDeleteCursor().

00388 {
00389     m_Folder.SetCursor(nEntry);
00390     m_Folder.Scratch();
00391     UpdateAllViews(NULL);
00392 }

void Model::CPraktikumMFCDoc::ShowCustomerinformation ( ) const

Show folder's properties

See also:
CFolderDialog
Invariant:
see CFolderDialog

Definition at line 108 of file PraktikumMFCDoc.cpp.

Referenced by View::CPraktikumMFCView::OnShowCustomerinformation().

00109 {
00110     View::CFolderDialog dlg;
00111     dlg.m_nCardinality = m_Folder.Card();
00112     dlg.m_strDateOfFoundation = m_Folder.GetDateOfFoundation().Format("%A, %d.%B, %Y, %H:%M:%S");
00113     dlg.m_strCustomerInformation = m_Folder.GetCustomerInformation();
00114
00115     dlg.DoModal();
00116 }

Member Data Documentation

Model::CFolder Model::CPraktikumMFCDoc::m_Folder

Definition at line 39 of file PraktikumMFCDoc.h.

The documentation for this class was generated from the following files:
  • PraktikumMFCDoc.h
  • PraktikumMFCDoc.cpp


View::CPraktikumMFCView Class Reference

The main view. More...

#include <PraktikumMFCView.h>

Inheritance diagram for View::CPraktikumMFCView::

CListView List of all members.

Public Methods

Model::CPraktikumMFCDoc * GetDocument ()
get attached document. More...

virtual void | OnDraw (CDC *pDC)
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs)

Protected Methods

CPraktikumMFCView ()
default constructor. More...

virtual void | OnUpdate (CView *pSender, LPARAM lHint, CObject *pHint)
afx_msg void | OnDblclk (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnPressedReturn (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void | OnShowCursor ()
afx_msg void | OnUpdateShowCursor (CCmdUI *pCmdUI)
afx_msg void | OnDeleteAll ()
afx_msg void | OnUpdateDeleteAll (CCmdUI *pCmdUI)
afx_msg void | OnDeleteCursor ()
afx_msg void | OnUpdateDeleteCursor (CCmdUI *pCmdUI)
afx_msg void | OnContextMenu (CWnd *pWnd, CPoint point)
afx_msg void | OnShowCustomerinformation ()
afx_msg void | OnInsertBankdocument ()
afx_msg void | OnInsertForm ()
afx_msg void | OnInsertStandingorder ()
afx_msg void | OnInsertContract ()
afx_msg void | OnShowDebug ()
afx_msg void | OnUpdateShowDebug (CCmdUI *pCmdUI)
afx_msg void | OnUpdateScenario (CCmdUI *pCmdUI)
afx_msg void | OnWindowDebug ()
afx_msg void | OnUpdateWindowDebug (CCmdUI *pCmdUI)
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct)
afx_msg void | OnScenarioCopyequalvalue ()
afx_msg void | OnScenarioFind ()
afx_msg void | OnScenarioEqualValue ()
afx_msg void | OnScenarioInsert ()
afx_msg void | OnShowDebugCurrent ()
afx_msg void | OnScenarioCopyequalvalueFolder ()
afx_msg void | OnScenarioFindscratchfindFolder ()
afx_msg void | OnScenarioInsertcardFolder ()
afx_msg void | OnScenarioInsertfindgetcurrentFolder ()
afx_msg void | OnScenarioScratchcardFolder ()

Detailed Description

  • view of the application
Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • (none)

Definition at line 28 of file PraktikumMFCView.h.

Constructor & Destructor Documentation

View::CPraktikumMFCView::CPraktikumMFCView ( ) [inline, protected]

Nothing left to do

Definition at line 34 of file PraktikumMFCView.h.

00034 {};

Member Function Documentation

Model::CPraktikumMFCDoc * View::CPraktikumMFCView::GetDocument ( ) [inline]

Return the document that is attached to current view

Returns:
pointer to the document

Definition at line 125 of file PraktikumMFCView.h.

Referenced by OnDblclk(), OnDeleteAll(), OnDeleteCursor(), OnDraw(), OnInsertBankdocument(), OnInsertContract(), OnInsertForm(), OnInsertStandingorder(), OnScenarioCopyequalvalue(), OnScenarioCopyequalvalueFolder(), OnScenarioEqualValue(), OnScenarioFind(), OnScenarioFindscratchfindFolder(), OnScenarioInsert(), OnScenarioInsertcardFolder(), OnScenarioInsertfindgetcurrentFolder(), OnScenarioScratchcardFolder(), OnShowCursor(), OnShowCustomerinformation(), OnShowDebug(), OnShowDebugCurrent(), OnUpdate(), OnUpdateDeleteAll(), and OnUpdateShowCursor().

00126 { return (Model::CPraktikumMFCDoc*)m_pDocument; }

void View::CPraktikumMFCView::OnDraw ( CDC * pDC ) [virtual]

Redraw view (CListView draws itself properly, see OnUpdate)

Parameters:
pDC device context that needs to be redrawn
See also:
OnUpdate

Definition at line 92 of file PraktikumMFCView.cpp.

00093 {
00094     CPraktikumMFCDoc* pDoc = GetDocument();
00095     ASSERT_VALID(pDoc);
00096 }

BOOL View::CPraktikumMFCView::PreCreateWindow ( CREATESTRUCT & cs ) [virtual]

Set default window style (report that is maximized)

Parameters:
cs current window style
Returns:
true, if successful
See also:
OnCreate

Definition at line 40 of file PraktikumMFCView.cpp.

00041 {
00042     if (!CListView::PreCreateWindow(cs))
00043         return FALSE;
00044
00045     // change style to a list view
00046     cs.style &= ~LVS_TYPEMASK;
00047     cs.style |= LVS_REPORT;
00048
00049     return TRUE;
00050 }

void View::CPraktikumMFCView::OnUpdate | ( | CView * | pSender,
 |  | LPARAM | lHint,
 |  | CObject * | pHint
 | ) | [protected, virtual]

Update view because of changed document

Parameters:
pSender | message source (not used)
lHint | parameter (not used)
pHint | parameter (not used)

Definition at line 105 of file PraktikumMFCView.cpp.

00106 {
00107     // call parent class
00108     CListView::OnUpdate(pSender, lHint, pHint);
00109
00110     // get list control of our list view
00111     CListCtrl& list = GetListCtrl();
00112     // delete all entries
00113     list.DeleteAllItems();
00114
00115     // get folder
00116     CFolder* pFolder = &(GetDocument()->m_Folder);
00117     // determine size
00118     int nCount = pFolder->Card();
00119     // disable and exit if empty
00120     if (nCount == 0)
00121     {
00122         list.EnableWindow(FALSE);
00123         return;
00124     }
00125
00126     // enable window (white background instead of grey)
00127     list.EnableWindow(TRUE);
00128
00129     // prepare control that we insert some items
00130     list.SetItemCount(nCount);
00131
00132     // process all elements of the set
00133     for (int i=0; i<nCount; i++)
00134     {
00135         // get current element
00136         const CBankDocument* pBankDocument;
00137         if (i==0)
00138             pBankDocument = pFolder->GetFirst();
00139         else
00140             pBankDocument = pFolder->GetNext();
00141
00142         // show title
00143         list.InsertItem(i, pBankDocument->GetTitle());
00144         // show author
00145         list.SetItemText(i, 1, pBankDocument->GetAuthor());
00146         // show date of foundation
00147         CString a = pBankDocument->GetDateOfFoundation();
00148         list.SetItemText(i, 2, (CString)pBankDocument->GetDateOfFoundation());
00149
00150         // show type
00151         // first, determine class name
00152         CString strClassname = pBankDocument->GetRuntimeClass()->m_lpszClassName;
00153         if (strClassname == "CBankDocument")
00154             strClassname = "Bankdokument";
00155         else
00156             if (strClassname == "CForm")
00157             {
00158                 strClassname = "Formular";
00159                 list.SetItemText(i, 3,
00160                     (CString)((CForm*)pBankDocument)->GetAlterationDate());
00161             }
00162             else
00163                 if (strClassname == "CStandingOrder")
00164                 {
00165                     strClassname = "Dauerauftrag";
00166                     list.SetItemText(i, 3,
00167                         (CString)((CStandingOrder*)pBankDocument)->GetAlterationDate());
00168                 }
00169                 else
00170                     if (strClassname == "CContract")
00171                     {
00172                         strClassname = "Vertrag";
00173                         list.SetItemText(i, 3,
00174                             (CString)((CContract*)pBankDocument)->GetAlterationDate());
00175                     }
00176                     else
00177                         strClassname = "unbekannt ("+strClassname+")";
00178
00179         // actually show type
00180         list.SetItemText(i, 4, strClassname);
00181
00182         // delete copy fo the set's element
00183         delete pBankDocument;
00184     }
00185
00186 }

void View::CPraktikumMFCView::OnDblclk | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Called on double-clicks

Parameters:
pNMHDR | (not used)
pResult | (see return value)
Returns:
NULL if successful
See also:
CPraktikumMFCDoc::EditEntry

Definition at line 196 of file PraktikumMFCView.cpp.

00197 {
00198     // code taken from Jeff Prosise's "MFC Programming" book, p. 545 (German edition)
00199
00200     // get mouse position
00201     DWORD dwPos = ::GetMessagePos();
00202     CPoint point ((int) LOWORD(dwPos), (int) HIWORD(dwPos));
00203     // convert from screen to window coordinates
00204     GetListCtrl().ScreenToClient(&point);
00205
00206     // determine correspending list entry
00207     int nIndex = GetListCtrl().HitTest(point);
00208
00209     // schnipp ! now my own code !
00210     if (nIndex != -1)
00211     {
00212         // edit list entry
00213         TRACE("%d clicked\n", nIndex);
00214         GetDocument()->EditEntry(nIndex);
00215     }
00216
00217     // okay, this very last line was written by Prosise, too
00218     *pResult = 0;
00219 }

void View::CPraktikumMFCView::OnPressedReturn | ( | NMHDR * | pNMHDR,
 |  | LRESULT * | pResult
 | ) | [protected]

Show current entry (called if user pressed "Return")

Parameters:
pNMHDR | (not used)
pResult | (see return value)
Returns:
NULL if successful
See also:
OnShowCursor, OnDblclk

Definition at line 229 of file PraktikumMFCView.cpp.

00230 {
00231     OnShowCursor();
00232     *pResult = 0;
00233 }

void View::CPraktikumMFCView::OnShowCursor ( ) [protected]

Show current entry

See also:
OnPressedReturn, OnDblclk

Definition at line 240 of file PraktikumMFCView.cpp.

Referenced by OnPressedReturn().

00241 {
00242     // cursor position
00243     int nSelected = GetListCtrl().GetSelectionMark();
00244
00245     // only -1 if no document is selected
00246     if (nSelected != -1)
00247         GetDocument()->EditEntry(nSelected);
00248 }

void View::CPraktikumMFCView::OnUpdateShowCursor ( CCmdUI * pCmdUI ) [protected]

Control menu entry that fires "OnShowCursor". Enable only if set is non-empty and list selection is valid

Parameters:
pCmdUI menu entry
See also:
OnShowCursor

Definition at line 257 of file PraktikumMFCView.cpp.

00258 {
00259     if (GetDocument()->m_Folder.Card() == 0 ||
00260         GetListCtrl().GetSelectionMark() == -1)
00261         pCmdUI->Enable(FALSE);
00262     else
00263         pCmdUI->Enable(TRUE);
00264 }

void View::CPraktikumMFCView::OnDeleteAll ( ) [protected]

Delete the whole set

See also:
OnUpdateDeleteAll, CPraktikumMFCDoc::DeleteAll

Definition at line 271 of file PraktikumMFCView.cpp.

00272 {
00273     if (AfxMessageBox("Sind Sie sicher, dass Sie alle Dokumente löschen wollen ?",
00274                       MB_YESNO|MB_ICONQUESTION) == IDYES)
00275         GetDocument()->DeleteAll();
00276 }

void View::CPraktikumMFCView::OnUpdateDeleteAll ( CCmdUI * pCmdUI ) [protected]

Control menu entry that fires "OnDeleteAll". Enable only if set is non-empty

Parameters:
pCmdUI menu entry
See also:
OnDeleteAll

Definition at line 285 of file PraktikumMFCView.cpp.

00286 {
00287     if (GetDocument()->m_Folder.Card() == 0)
00288         pCmdUI->Enable(FALSE);
00289     else
00290         pCmdUI->Enable(TRUE);
00291 }

void View::CPraktikumMFCView::OnDeleteCursor ( ) [protected]

Delete the current element

See also:
OnUpdateDeleteCursor, CPraktikumMFCDoc::DeleteEntry

Definition at line 298 of file PraktikumMFCView.cpp.

00299 {
00300     int nSelected = GetListCtrl().GetSelectionMark();
00301
00302     if (nSelected != -1)
00303         if (AfxMessageBox("Sind Sie sicher, dass Sie das gewählte Dokument löschen wollen ?",
00304                           MB_YESNO|MB_ICONQUESTION) == IDYES)
00305             GetDocument()->DeleteEntry(nSelected);
00306 }

void View::CPraktikumMFCView::OnUpdateDeleteCursor ( CCmdUI * pCmdUI ) [protected]

Control menu entry that fires "OnDeleteCursor". Enable only if list selection is valid

Parameters:
pCmdUI menu entry
See also:
OnDeleteCursor

Definition at line 315 of file PraktikumMFCView.cpp.

00316 {
00317     if (GetListCtrl().GetSelectionMark() == -1)
00318         pCmdUI->Enable(FALSE);
00319     else
00320         pCmdUI->Enable(TRUE);
00321 }

void View::CPraktikumMFCView::OnContextMenu | ( | CWnd * | pWnd,
 |  | CPoint | point
 | ) | [protected]

Show context menu on right mouse button click

Parameters:
pWnd | window that requests the context menu
point | mouse position

Definition at line 329 of file PraktikumMFCView.cpp.

00330 {
00331     // call parent class
00332     CWnd::OnContextMenu(pWnd, point);
00333
00334     // load menu
00335     CMenu menu;
00336     menu.LoadMenu(IDR_CONTEXTMENU);
00337
00338     // extract context menu
00339     CMenu* pContextMenu = menu.GetSubMenu(0);
00340     // show it
00341     pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00342                                  point.x, point.y, AfxGetMainWnd());
00343 }

void View::CPraktikumMFCView::OnShowCustomerinformation ( ) [protected]

Show the folder's properties

See also:
CPraktikumMFCDoc::ShowCustomerinformation

Definition at line 386 of file PraktikumMFCView.cpp.

00387 {
00388     GetDocument()->ShowCustomerinformation();
00389 }

void View::CPraktikumMFCView::OnInsertBankdocument ( ) [protected]

Insert a new bank document

See also:
CPraktikumMFCDoc::InsertBankdocument

Definition at line 350 of file PraktikumMFCView.cpp.

00351 {
00352     GetDocument()->InsertBankdocument();
00353 }

void View::CPraktikumMFCView::OnInsertForm ( ) [protected]

Insert a new form

See also:
CPraktikumMFCDoc::InsertForm

Definition at line 359 of file PraktikumMFCView.cpp.

00360 {
00361     GetDocument()->InsertForm();
00362 }

void View::CPraktikumMFCView::OnInsertStandingorder ( ) [protected]

Insert a new standing order

See also:
CPraktikumMFCDoc::InsertStandingorder

Definition at line 368 of file PraktikumMFCView.cpp.

00369 {
00370     GetDocument()->InsertStandingorder();
00371 }

void View::CPraktikumMFCView::OnInsertContract ( ) [protected]

Insert a new contract

See also:
CPraktikumMFCDoc::InsertContract

Definition at line 377 of file PraktikumMFCView.cpp.

00378 {
00379     GetDocument()->InsertContract();
00380 }

void View::CPraktikumMFCView::OnShowDebug ( ) [protected]

Create dump of the whole folder

See also:
CPraktikumMFCDoc::ShowDebug

Definition at line 396 of file PraktikumMFCView.cpp.

00397 {
00398 #ifdef _DEBUG
00399     GetDocument()->m_Folder.Dump(afxDump);
00400 #endif
00401 }

void View::CPraktikumMFCView::OnUpdateShowDebug ( CCmdUI * pCmdUI ) [protected]

Enable/disable menu entry for OnShowDebug

Parameters:
pCmdUI menu entry that should be modified
See also:
OnShowDebug

Definition at line 425 of file PraktikumMFCView.cpp.

00426 {
00427     pCmdUI->Enable(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug());
00428 }

void View::CPraktikumMFCView::OnUpdateScenario ( CCmdUI * pCmdUI ) [protected]

Enable/disable menu entry for all scenarios

Parameters:
pCmdUI menu entry that should be modified
See also:
Debug::CScenario

Definition at line 565 of file PraktikumMFCView.cpp.

00566 {
00567 #ifndef _DEBUG
00568     pCmdUI->Enable(FALSE);
00569 #else
00570     pCmdUI->Enable(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug() &&
00571                    GetListCtrl().GetSelectionMark() != -1);
00572 #endif
00573 }

void View::CPraktikumMFCView::OnWindowDebug ( ) [protected]

Open debug dialog

See also:
CPraktikumMFCApp::OnShowDebug

Definition at line 435 of file PraktikumMFCView.cpp.

00436 {
00437     ((Application::CPraktikumMFCApp*)AfxGetApp())->OnShowDebug();
00438 }

void View::CPraktikumMFCView::OnUpdateWindowDebug ( CCmdUI * pCmdUI ) [protected]

Enable/disable menu entry for OnWindowDebug

Parameters:
pCmdUI menu entry that should be modified
See also:
OnWindowDebug

Definition at line 446 of file PraktikumMFCView.cpp.

00447 {
00448     pCmdUI->SetCheck(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug());
00449 }

int View::CPraktikumMFCView::OnCreate ( LPCREATESTRUCT lpCreateStruct ) [protected]

Set CListView's style and define columns

Parameters:
lpCreateStruct passed to CWnd::OnCreate
Returns:
0, if successful
See also:
PreCreateWindow

Definition at line 59 of file PraktikumMFCView.cpp.

00060 {
00061     if (CListView::OnCreate(lpCreateStruct) == -1)
00062         return -1;
00063
00064     // get list control of our list view
00065     CListCtrl& list = GetListCtrl();
00066
00067     // set style
00068     list.ModifyStyle(0, LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER);
00069     list.SetExtendedStyle(list.GetExtendedStyle() |
00070                           LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES |
00071                           LVS_EX_FLATSB        | LVS_EX_TWOCLICKACTIVATE |
00072                           /*LVS_EX_LABELTIP*/ 0x00004000);
00073
00074     list.GetHeaderCtrl()->ModifyStyle(HDS_BUTTONS, 0);
00075
00076     // add needed columns
00077     list.InsertColumn(0, "Titel",   LVCFMT_LEFT, 150);
00078     list.InsertColumn(1, "Autor",   LVCFMT_LEFT, 100);
00079     list.InsertColumn(2, "Erstellt am",   LVCFMT_LEFT, 200);
00080     list.InsertColumn(3, "Geändert am",   LVCFMT_LEFT, 200);
00081     list.InsertColumn(4, "Typ",     LVCFMT_LEFT, 100);
00082
00083     return 0;
00084 }

void View::CPraktikumMFCView::OnScenarioCopyequalvalue ( ) [protected]

Run scenario Copy/EqualValue (document)

See also:
Debug::CScenario::Copyequalvalue

Definition at line 456 of file PraktikumMFCView.cpp.

00457 {
00458 #ifdef _DEBUG
00459     Debug::CScenario::Copyequalvalue(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00460 #endif
00461 }

void View::CPraktikumMFCView::OnScenarioFind ( ) [protected]

Run scenario Find

See also:
Debug::CScenario::Find

Definition at line 468 of file PraktikumMFCView.cpp.

00469 {
00470 #ifdef _DEBUG
00471     Debug::CScenario::Find(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00472 #endif
00473 }

void View::CPraktikumMFCView::OnScenarioEqualValue ( ) [protected]

Run scenario EqualValue

See also:
Debug::CScenario::EqualValue

Definition at line 480 of file PraktikumMFCView.cpp.

00481 {
00482 #ifdef _DEBUG
00483     Debug::CScenario::EqualValue(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00484 #endif
00485 }

void View::CPraktikumMFCView::OnScenarioInsert ( ) [protected]

Run scenario Insert

See also:
Debug::CScenario::Insert

Definition at line 492 of file PraktikumMFCView.cpp.

00493 {
00494 #ifdef _DEBUG
00495     Debug::CScenario::Insert(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00496 #endif
00497 }

void View::CPraktikumMFCView::OnShowDebugCurrent ( ) [protected]

Create dump of the currently selectly document

See also:
OnShowDebug

Definition at line 408 of file PraktikumMFCView.cpp.

00409 {
00410 #ifdef _DEBUG
00411     GetDocument()->m_Folder.SetCursor(GetListCtrl().GetSelectionMark());
00412
00413     CBankDocument* bankdocument = GetDocument()->m_Folder.GetCurrent();
00414     bankdocument->Dump(afxDump);
00415     delete bankdocument;
00416 #endif
00417 }

void View::CPraktikumMFCView::OnScenarioCopyequalvalueFolder ( ) [protected]

Run scenario Copy/EqualValue (CFolder)

See also:
Debug::CScenario::CopyequalvalueFolder

Definition at line 504 of file PraktikumMFCView.cpp.

00505 {
00506 #ifdef _DEBUG
00507     Debug::CScenario::CopyequalvalueFolder(GetDocument()->m_Folder);
00508 #endif
00509 }

void View::CPraktikumMFCView::OnScenarioFindscratchfindFolder ( ) [protected]

Run scenario Find/Scratch/Find

See also:
Debug::CScenario::FindscratchfindFolder

Definition at line 516 of file PraktikumMFCView.cpp.

00517 {
00518 #ifdef _DEBUG
00519     Debug::CScenario::FindscratchfindFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00520 #endif
00521 }

void View::CPraktikumMFCView::OnScenarioInsertcardFolder ( ) [protected]

Run scenario Insert/Card

See also:
Debug::CScenario::InsertcardFolder

Definition at line 528 of file PraktikumMFCView.cpp.

00529 {
00530 #ifdef _DEBUG
00531     Debug::CScenario::InsertcardFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00532 #endif
00533 }

void View::CPraktikumMFCView::OnScenarioInsertfindgetcurrentFolder ( ) [protected]

Run scenario Insert/Find/GetCurrent

See also:
Debug::CScenario::InsertfindgetcurrentFolder

Definition at line 540 of file PraktikumMFCView.cpp.

00541 {
00542 #ifdef _DEBUG
00543     Debug::CScenario::InsertfindgetcurrentFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00544 #endif
00545 }

void View::CPraktikumMFCView::OnScenarioScratchcardFolder ( ) [protected]

Run scenario Scratch/Card

See also:
Debug::CScenario::ScratchcardFolder

Definition at line 552 of file PraktikumMFCView.cpp.

00553 {
00554 #ifdef _DEBUG
00555     Debug::CScenario::ScratchcardFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00556 #endif
00557 }

The documentation for this class was generated from the following files:
  • PraktikumMFCView.h
  • PraktikumMFCView.cpp


Debug::CScenario Class Reference

Generate scenarios. More...

#include <Scenario.h>

List of all members.

Static Public Methods

void | Copyequalvalue (CFolder &m_Folder, int nEntry)
Copy/EqualValue (document, case 1). More...

void | Find (CFolder &m_Folder, int nEntry)
Find a given document. More...

void | EqualValue (CFolder &m_Folder, int nEntry)
Compare two slightly different documents. More...

void | Insert (CFolder &m_Folder, int nEntry)
Insert an already existing document. More...

void | CopyequalvalueFolder (CFolder &m_Folder)
Copy/EqualValue (folder, case 1). More...

void | InsertfindgetcurrentFolder (CFolder &m_Folder, int nEntry)
Insert/Find/GetCurrent (case 2);. More...

void | FindscratchfindFolder (CFolder &m_Folder, int nEntry)
Find/Scratch/Find (case 3). More...

void | InsertcardFolder (CFolder &m_Folder, int nEntry)
Insert/Card (case 4). More...

void | ScratchcardFolder (CFolder &m_Folder, int nEntry)
Scratch/Card (case 5). More...

Detailed Description

Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • (none)

Definition at line 27 of file Scenario.h.

Member Function Documentation

void Debug::CScenario::Copyequalvalue | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Case 1 of all documents: copy a document and compare copy/original document
Attention:
always true !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 36 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioCopyequalvalue().

00037 {
00038     if (AfxMessageBox("Dieses Szenario kopiert das gerade gewählte Dokument und\n"
00039                       "vergleicht anschließend Original und Kopie.\n\n"
00040                       "Der Test muss stets erfolgreich verlaufen.\n"
00041                       "Es werden keine Daten in der Originalkartei verändert.\n",
00042                       MB_OKCANCEL) == IDOK)
00043     {
00044         // move cursor to the selected element
00045         m_Folder.SetCursor(nEntry);
00046         // get it
00047         CBankDocument* pObject = m_Folder.GetCurrent();
00048         // generate copy
00049         CBankDocument* pObject2 = (CBankDocument*)pObject->Generate();
00050
00051         // copy
00052         TRACE("\nScenario Copy/EqualValue (document-based)\n");
00053         pObject->Dump(afxDump);
00054         TRACE("Now copying ...\n");
00055         *pObject2 = *pObject;
00056
00057         // compare
00058         TRACE("\n\nAnd comparing ...\n");
00059         ASSERT (*pObject == *pObject2);
00060         pObject2->Dump(afxDump);
00061
00062         // free allocated memory
00063         delete pObject;
00064         delete pObject2;
00065
00066         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00067     }
00068 }

void Debug::CScenario::Find | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Find an already existing document of the set
Attention:
always true !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 77 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioFind().

00078 {
00079     if (AfxMessageBox("Dieses Szenario sucht das gerade gewählte Dokument in der Kartei.\n\n"
00080                       "Der Test muss stets erfolgreich verlaufen.\n"
00081                       "Es werden keine Daten in der Originalkartei verändert.\n",
00082                       MB_OKCANCEL) == IDOK)
00083     {
00084         // move cursor to the selected element
00085         m_Folder.SetCursor(nEntry);
00086         // get it
00087         CBankDocument* pObject = m_Folder.GetCurrent();
00088
00089         TRACE("\nScenario Find\n");
00090         pObject->Dump(afxDump);
00091
00092         // find
00093         TRACE("Searching ...\n");
00094         ASSERT(m_Folder.Find(pObject));
00095
00096         // free allocated memory
00097         delete pObject;
00098
00099         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00100     }
00101 }

void Debug::CScenario::EqualValue | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Create a copy and slightly change date of foundation
Attention:
always true, because date of foundation is not used for comparisons !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 110 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioEqualValue().

00111 {
00112     if (AfxMessageBox("Dieses Szenario vergleicht das gerade gewählte Dokument\n"
00113                       "mit einer Kopie, bei der das Erzeugungsdatum verändert wurde.\n"
00114                       "Der Test muss stets erfolgreich verlaufen.\n"
00115                       "Es werden keine Daten in der Originalkartei verändert.\n",
00116                       MB_OKCANCEL) == IDOK)
00117     {
00118         // move cursor to the selected element
00119         m_Folder.SetCursor(nEntry);
00120         // get it (only used as CBankDocument)
00121         CBankDocument* pObject = m_Folder.GetCurrent();
00122
00123         // create a copy, modify date
00124         CBankDocument* pObject2 = new CBankDocument(pObject->GetAuthor(), pObject->GetTitle(),
00125                                                     pObject->GetKey());
00126
00127         TRACE("\nScenario Find\n");
00128         pObject->Dump(afxDump);
00129
00130         // compare (as CBankDocuments !!!)
00131         TRACE("Comparing ...\n");
00132         ASSERT(*pObject2 == *pObject);
00133
00134         // free allocated memory
00135         delete pObject2;
00136         delete pObject;
00137
00138         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00139     }
00140 }

void Debug::CScenario::Insert | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Insert an already document into the set
Attention:
fails always !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 149 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioInsert().

00150 {
00151     if (AfxMessageBox("Dieses Szenario versucht, das gerade gewählte Dokument\n"
00152                       "erneut in die Kartei einzufügen.\n\n"
00153                       "Der Test darf nicht erfolgreich verlaufen.\n"
00154                       "Es werden keine Daten in der Originalkartei verändert.\n",
00155                       MB_OKCANCEL) == IDOK)
00156     {
00157         // move cursor to the selected element
00158         m_Folder.SetCursor(nEntry);
00159         // get it
00160         CBankDocument* pObject = m_Folder.GetCurrent();
00161
00162         TRACE("\nScenario Find\n");
00163         pObject->Dump(afxDump);
00164
00165         // insert
00166         TRACE("Inserting ...\n");
00167         ASSERT(m_Folder.Insert(pObject) != -1);
00168
00169         // free allocated memory
00170         delete pObject;
00171
00172         TRACE("\nThis scenario was successfully completed if a window popped up !\n\n");
00173     }
00174 }

void Debug::CScenario::CopyequalvalueFolder ( CFolder & m_Folder ) [static]

Test:
Case 1 (CFolder): copy a folder and compare copy/original folder
Attention:
always true !
Parameters:
m_Folder used folder

Definition at line 182 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioCopyequalvalueFolder().

00183 {
00184     if (AfxMessageBox("Dieses Szenario kopiert die aktuelle Kartei und\n"
00185                       "vergleicht anschließend Original und Kopie.\n\n"
00186                       "Der Test muss stets erfolgreich verlaufen.\n"
00187                       "Es werden keine Daten in der Originalkartei verändert.\n",
00188                       MB_OKCANCEL) == IDOK)
00189     {
00190         // create new folder
00191         CFolder* pFolder = new CFolder();
00192
00193         TRACE("\nScenario Copy/EqualValue (folder-based)\n");
00194         m_Folder.Dump(afxDump);
00195
00196         // copy
00197         TRACE("Now copying ...\n");
00198         *pFolder = m_Folder;
00199
00200         // compare
00201         TRACE("\n\nAnd comparing ...\n");
00202         ASSERT (m_Folder == *pFolder);
00203
00204         // free allocated memory
00205         delete pFolder;
00206
00207         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00208     }
00209 }

void Debug::CScenario::InsertfindgetcurrentFolder | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Case 2 (CFolder): Insert a document into the set, find and retrieve it, compare it to the original
Attention:
always true !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 218 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioInsertfindgetcurrentFolder().

00219 {
00220     if (AfxMessageBox("Dieses Szenario fügt ein neues Bankdokument in die Kartei ein.\n"
00221                       "Anschließend wird danach gesucht, was den Cursor verändert.\n"
00222                       "Da es dann das aktuelle Element ist, wird es ausgelesen und muss mit dem Original übereinstimmen.\n\n"
00223                       "Der Test muss stets erfolgreich verlaufen.\n"
00224                       "Es werden keine Daten in der Originalkartei verändert.\n",
00225                       MB_OKCANCEL) == IDOK)
00226     {
00227         // new bankdocument
00228         CBankDocument bankdocument("Testautor_", "Testtitel_", "Testkey_");
00229         TRACE("\nScenario Insert/Find/GetCurrent\n");
00230         bankdocument.Dump(afxDump);
00231
00232         // copy folder (to avoid modifactions to the original one)
00233         CFolder* pFolder = new CFolder(m_Folder);
00234
00235         // insert
00236         TRACE("Inserting ...\n");
00237         ASSERT(pFolder->Insert(&bankdocument));
00238
00239         // find
00240         TRACE("Looking up ...\n");
00241         ASSERT(pFolder->Find(&bankdocument));
00242
00243         // get current
00244         TRACE("Getting current document ...\n");
00245         CBankDocument *pBankDocument = pFolder->GetCurrent();
00246
00247         // compare
00248         TRACE("Comparing ...\n");
00249         ASSERT(bankdocument == *pBankDocument);
00250
00251         // free allocated memory
00252         delete pBankDocument;
00253         delete pFolder;
00254
00255         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00256     }
00257 }

void Debug::CScenario::FindscratchfindFolder | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Case 3 (CFolder): Find a document, scratch it and search for it again
Attention:
fails always !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 266 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioFindscratchfindFolder().

00267 {
00268     if (AfxMessageBox("Dieses Szenario sucht das gerade gewählte Dokument in der Kartei.\n"
00269                       "Anschließend wird es gelöscht und erneut danach gesucht.\n\n"
00270                       "Der Test darf nicht erfolgreich verlaufen.\n"
00271                       "Es werden keine Daten in der Originalkartei verändert.\n",
00272                       MB_OKCANCEL) == IDOK)
00273     {
00274         // move cursor to the selected element
00275         m_Folder.SetCursor(nEntry);
00276         // get it
00277         CBankDocument* pObject = m_Folder.GetCurrent();
00278
00279         TRACE("\nScenario Find/Scratch/Find\n");
00280         pObject->Dump(afxDump);
00281
00282         // copy folder (to avoid modifactions to the original one)
00283         CFolder* pFolder = new CFolder(m_Folder);
00284
00285         // find
00286         TRACE("Looking up document ...\n");
00287         ASSERT(pFolder->Find(pObject));
00288
00289         // scratch
00290         TRACE("Scratch it ...\n");
00291         pFolder->Scratch();
00292
00293         // find again
00294         TRACE("Looking up document for a second time ...\n");
00295         ASSERT(pFolder->Find(pObject));
00296
00297         // free allocated memory
00298         delete pObject;
00299         delete pFolder;
00300
00301         TRACE("\nThis scenario was successfully completed if a window popped up !\n\n");
00302     }
00303 }

void Debug::CScenario::InsertcardFolder | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Case 4 (CFolder): Insert a new document - cardinality must increase by 1
Attention:
always true !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 312 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioInsertcardFolder().

00313 {
00314     if (AfxMessageBox("Dieses Szenario fügt ein neues Bankdokument in die Kartei ein.\n"
00315                       "Anschließend muss die Anzahl der Elemente um 1 größer sein.\n\n"
00316                       "Der Test muss stets erfolgreich verlaufen.\n"
00317                       "Es werden keine Daten in der Originalkartei verändert.\n",
00318                       MB_OKCANCEL) == IDOK)
00319     {
00320         // new bankdocument
00321         CBankDocument bankdocument("Testautor_", "Testtitel_", "Testkey_");
00322         TRACE("\nScenario Insert/Card\n");
00323         bankdocument.Dump(afxDump);
00324
00325         // copy folder (to avoid modifactions to the original one)
00326         CFolder* pFolder = new CFolder(m_Folder);
00327
00328         // cardinality
00329         int nOldCard = pFolder->Card();
00330         TRACE("Old Card: %d\n", nOldCard);
00331
00332         // insert
00333         TRACE("Inserting ...\n");
00334         ASSERT(pFolder->Insert(&bankdocument));
00335
00336         // cardinality for the second time
00337         int nNewCard = pFolder->Card();
00338         TRACE("New Card: %d\n", nNewCard);
00339
00340         // verify condition
00341         ASSERT(nOldCard+1==nNewCard);
00342
00343         // free allocated memory
00344         delete pFolder;
00345
00346         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00347     }
00348 }

void Debug::CScenario::ScratchcardFolder | ( | CFolder & | m_Folder,
 |  | int | nEntry
 | ) | [static]

Test:
Case 5 (CFolder): Scratch current document - cardinality must decrease by 1
Attention:
always true !
Parameters:
m_Folder | used folder
nEntry | used document

Definition at line 357 of file Scenario.cpp.

Referenced by View::CPraktikumMFCView::OnScenarioScratchcardFolder().

00358 {
00359     if (AfxMessageBox("Dieses Szenario löscht das aktuell gewählte Dokument aus der Kartei.\n"
00360                       "Anschließend muss die Anzahl der Elemente um 1 niedriger sein.\n\n"
00361                       "Der Test muss stets erfolgreich verlaufen.\n"
00362                       "Es werden keine Daten in der Originalkartei verändert.\n",
00363                       MB_OKCANCEL) == IDOK)
00364     {
00365         // move cursor to the selected element
00366         m_Folder.SetCursor(nEntry);
00367         // get it
00368         CBankDocument* pObject = m_Folder.GetCurrent();
00369
00370         TRACE("\nScenario Scratch/Card\n");
00371
00372         // copy folder (to avoid modifactions to the original one)
00373         CFolder* pFolder = new CFolder(m_Folder);
00374
00375         // cardinality
00376         int nOldCard = pFolder->Card();
00377         TRACE("Old Card: %d\n", nOldCard);
00378
00379         // find
00380         TRACE("Looking up ...\n");
00381         ASSERT(pFolder->Find(pObject));
00382
00383         // scratch
00384         TRACE("Scratching ...\n");
00385         pFolder->Scratch();
00386
00387         // cardinality for the second time
00388         int nNewCard = pFolder->Card();
00389         TRACE("New Card: %d\n", nNewCard);
00390
00391         // verify condition
00392         ASSERT(nOldCard-1==nNewCard);
00393
00394         // free allocated memory
00395         delete pObject;
00396         delete pFolder;
00397
00398         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00399     }
00400 }

The documentation for this class was generated from the following files:
  • Scenario.h
  • Scenario.cpp


Model::CStandingOrder Class Reference

A standing order. More...

#include <StandingOrder.h>

Inheritance diagram for Model::CStandingOrder::

Model::CForm Model::CBankDocument CObject List of all members.

Public Methods

CStandingOrder ()
default constructor. More...

CStandingOrder (const CStandingOrder &standingorder)
copy constructor. More...

CStandingOrder (CString strAuthor, CString strTitle, CString strKey, bool bProved, bool bSigned, CString strFormality, unsigned int nAmount, CString strSubject, CString strSource, CString strRecipient, unsigned int nInterval)
explicitly set attributes. More...

virtual | ~CStandingOrder ()
destructor. More...

virtual CObject * | Generate () const
create a new object. More...

virtual CObject * | GenerateC () const
clone this object. More...

virtual void | Serialize (CArchive &ar)
serialization. More...

virtual void | AssertValid () const
validate. More...

virtual void | Dump (CDumpContext &dc) const
dump. More...

CStandingOrder & | operator= (const CStandingOrder &standingorder)
copy. More...

virtual CBankDocument & | operator= (const CBankDocument &bankdocument)
polymorphic copy. More...

bool | operator== (const CStandingOrder &standingorder) const
comparison. More...

virtual bool | operator== (const CBankDocument &bankdocument) const
polymorphic comparison. More...

virtual CString | KeyOf () const
deliver a unique identifier. More...

unsigned int | GetAmount () const
get amount. More...

unsigned int | GetInterval () const
get interval. More...

CString | GetSubject () const
get subject. More...

CString | GetSource () const
get source. More...

CString | GetRecipient () const
get recipient. More...

void | SetAmount (unsigned int nAmount)
set amount. More...

void | SetInterval (unsigned int nInterval)
set interval. More...

Private Attributes

unsigned int | m_nAmount
amount each term. More...

unsigned int | m_nInterval
number of terms. More...

CString | m_strSubject
subject to pay for. More...

CString | m_strSource
person who pays. More...

CString | m_strRecipient
person that gets paid. More...

Detailed Description

Author:
Stephan Brumme
Date:
August 23, 2001
Invariant:
  • all CString attributes must be non-empty
  • m_nAmount and m_nInterval must be positive (greater than zero)
  • parent class must be valid

Definition at line 26 of file StandingOrder.h.

Constructor & Destructor Documentation

Model::CStandingOrder::CStandingOrder ( )

Constructs a new and empty standing order

Definition at line 24 of file StandingOrder.cpp.

Referenced by GenerateC().

00025 {
00026     m_nAmount = m_nInterval = 0;
00027 }

Model::CStandingOrder::CStandingOrder ( const CStandingOrder & standingorder )

Copies an existing CStandingOrder

Parameters:
standingorder standing order to be copied
See also:
operator=

Definition at line 35 of file StandingOrder.cpp.

00036 {
00037     operator=(standingorder);
00038 }

Model::CStandingOrder::CStandingOrder | ( | CString | strAuthor,
 |  | CString | strTitle,
 |  | CString | strKey,
 |  | bool | bProved,
 |  | bool | bSigned,
 |  | CString | strFormality,
 |  | unsigned int | nAmount,
 |  | CString | strSubject,
 |  | CString | strSource,
 |  | CString | strRecipient,
 |  | unsigned int | nInterval
 | ) |

Constructs a new standing order using given attributes

Parameters:
strAuthor | author
strTitle | title
strKey | key
bProved | is it proved ?
bSigned | is it signed ?
strFormality | formality
nAmount | amount to be paid
nInterval | numbers of terms
strSubject | subject
strSource | source
strRecipient | recipient

Definition at line 55 of file StandingOrder.cpp.

00059               : CForm(strAuthor, strTitle, strKey, bProved, bSigned, strFormality)
00060 {
00061     m_nAmount      = nAmount;
00062     m_nInterval    = nInterval;
00063     m_strSubject   = strSubject;
00064     m_strSource    = strSource;
00065     m_strRecipient = strRecipient;
00066 }

Model::CStandingOrder::~CStandingOrder ( ) [virtual]

No clean-up required

Definition at line 72 of file StandingOrder.cpp.

00073 {
00074 }

Member Function Documentation

CObject * Model::CStandingOrder::Generate ( ) const [virtual]

Create a new non-initialized object

Returns:
new instance of CStandingOrder

Reimplemented from Model::CForm.

Definition at line 81 of file StandingOrder.cpp.

00082 {
00083     return new CStandingOrder;
00084 }

CObject * Model::CStandingOrder::GenerateC ( ) const [virtual]

Clone this object

Returns:
exact copy

Reimplemented from Model::CForm.

Definition at line 91 of file StandingOrder.cpp.

00092 {
00093     return new CStandingOrder(*this);
00094 }

void Model::CStandingOrder::Serialize ( CArchive & ar ) [virtual]

Loads/stores CStandingOrder

Parameters:
ar CArchive that provides data persistency

Reimplemented from Model::CForm.

Definition at line 101 of file StandingOrder.cpp.

00102 {
00103     // serialize parent
00104     CForm::Serialize(ar);
00105
00106     if (ar.IsStoring())
00107         ar << m_nAmount << m_nInterval << m_strSubject << m_strSource << m_strRecipient;
00108     else
00109         ar >> m_nAmount >> m_nInterval >> m_strSubject >> m_strSource >> m_strRecipient;
00110 }

void Model::CStandingOrder::AssertValid ( ) const [virtual]

Determines whether the standing order is valid, invariant describes further details (see above)

Reimplemented from Model::CForm.

Definition at line 117 of file StandingOrder.cpp.

00118 {
00119     CForm::AssertValid();
00120
00121     ASSERT(m_nAmount   > 0);
00122     ASSERT(m_nInterval > 0);
00123
00124     ASSERT(!m_strSubject.  IsEmpty());
00125     ASSERT(!m_strSource.   IsEmpty());
00126     ASSERT(!m_strRecipient.IsEmpty());
00127 }

void Model::CStandingOrder::Dump ( CDumpContext & dc ) const [virtual]

Create a dump of the class (only DEBUG version)

Parameters:
dc output dump stream

Reimplemented from Model::CForm.

Definition at line 134 of file StandingOrder.cpp.

Referenced by operator=(), and operator==().

00135 {
00136     CForm::Dump(dc);
00137
00138     CString strOutput;
00139     strOutput.Format("\namount: %d\ninterval: %d\nsubject: %s\nsource: %s\nrecipient: %s",
00140                      m_nAmount, m_nInterval, m_strSubject, m_strSource, m_strRecipient);
00141
00142     dc << strOutput;
00143 }

CStandingOrder & Model::CStandingOrder::operator= ( const CStandingOrder & standingorder )

Copies all attributes

Parameters:
standingorder CStandingOrder that should be copied
Returns:
reference to the copied standing order

Definition at line 151 of file StandingOrder.cpp.

Referenced by CStandingOrder(), and operator=().

00152 {
00153     // copy inherited attributes
00154     CForm::operator =(standingorder);
00155
00156     // copy CStandingOrder's attributes
00157     m_nAmount      = standingorder.m_nAmount;
00158     m_nInterval    = standingorder.m_nInterval;
00159     m_strSubject   = standingorder.m_strSubject;
00160     m_strSource    = standingorder.m_strSource;
00161     m_strRecipient = standingorder.m_strRecipient;
00162
00163     return *this;
00164 }

CBankDocument & Model::CStandingOrder::operator= ( const CBankDocument & bankdocument ) [virtual]

Copies all attributes for polymorphic behaviour

Parameters:
bankdocument CStandingOrder (casted as CBankDocument) that should be copied
Returns:
reference to the copied form

Reimplemented from Model::CForm.

Definition at line 172 of file StandingOrder.cpp.

00173 {
00174     try
00175     {
00176         // copy all attributes
00177         operator =(dynamic_cast<const CStandingOrder&>(bankdocument));
00178     }
00179     catch(...)
00180     {
00181         // invalid class
00182 #ifdef _DEBUG
00183         TRACE("Copy denied because of invalid cast (needed a CStandingOrder)\n");
00184         Dump(afxDump);
00185         bankdocument.Dump(afxDump);
00186 #endif
00187     }
00188
00189     return *this;
00190 }

bool Model::CStandingOrder::operator== ( const CStandingOrder & standingorder ) const

Compare attributes (except key) of two standing orders

Parameters:
form CStandingOrder that we compare to
Returns:
true, if all attributes are equal

Definition at line 198 of file StandingOrder.cpp.

Referenced by operator==().

00199 {
00200     return (CForm::operator ==(standingorder) &&
00201             m_nAmount       == standingorder.m_nAmount &&
00202             m_nInterval     == standingorder.m_nInterval &&
00203             m_strSubject    == standingorder.m_strSubject &&
00204             m_strSource     == standingorder.m_strSource &&
00205             m_strRecipient  == standingorder.m_strRecipient);
00206 }

bool Model::CStandingOrder::operator== ( const CBankDocument & bankdocument ) const [virtual]

Compares all attributes for polymorphic behaviour

Parameters:
bankdocument CStandingOrder (casted as CBankDocument) that should be compared to
Returns:
true, if all attributes are equal

Reimplemented from Model::CForm.

Definition at line 214 of file StandingOrder.cpp.

00215 {
00216     try
00217     {
00218         // compare all attributes
00219         return operator ==(dynamic_cast<const CStandingOrder&>(bankdocument));
00220     }
00221     catch(...)
00222     {
00223         // invalid class
00224         TRACE("Comparison denied because of invalid cast\n"
00225               "(needed a CStandingOrder and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00226 #ifdef _DEBUG
00227         Dump(afxDump);
00228         bankdocument.Dump(afxDump);
00229 #endif
00230     }
00231
00232     return false;
00233 }

CString Model::CStandingOrder::KeyOf ( ) const [virtual]

Responsible for the generation of a unique key based on the object's attributes

Returns:
CString that contains the key

Reimplemented from Model::CForm.

Definition at line 240 of file StandingOrder.cpp.

00241 {
00242     CString strKey;
00243     strKey.Format("[%d|%d|%s|%s|%s|%s|%p]", m_nAmount, m_nInterval,
00244                                             m_strSubject, m_strSource, m_strRecipient,
00245                                             CForm::KeyOf(),
00246                                             this);
00247     return strKey;
00248 }

unsigned int Model::CStandingOrder::GetAmount ( ) const

Get amount

Returns:
amount

Definition at line 255 of file StandingOrder.cpp.

00256 {
00257     return m_nAmount;
00258 }

unsigned int Model::CStandingOrder::GetInterval ( ) const

Get interval

Returns:
interval

Definition at line 263 of file StandingOrder.cpp.

00264 {
00265     return m_nInterval;
00266 }

CString Model::CStandingOrder::GetSubject ( ) const

Get subject

Returns:
subject

Definition at line 271 of file StandingOrder.cpp.

00272 {
00273     return m_strSubject;
00274 }

CString Model::CStandingOrder::GetSource ( ) const

Get source

Returns:
source

Definition at line 279 of file StandingOrder.cpp.

00280 {
00281     return m_strSource;
00282 }

CString Model::CStandingOrder::GetRecipient ( ) const

Get recipient

Returns:
recipient

Definition at line 287 of file StandingOrder.cpp.

00288 {
00289     return m_strRecipient;
00290 }

void Model::CStandingOrder::SetAmount ( unsigned int nAmount )

Set amount

Parameters:
nAmount amount

Definition at line 297 of file StandingOrder.cpp.

00298 {
00299     m_nAmount = nAmount;
00300     // update alteration date
00301     HasChanged();
00302 }

void Model::CStandingOrder::SetInterval ( unsigned int nInterval )

Set interval

Parameters:
nInterval interval

Definition at line 307 of file StandingOrder.cpp.

00308 {
00309     m_nInterval = nInterval;
00310     // update alteration date
00311     HasChanged();
00312 }

Member Data Documentation

unsigned int Model::CStandingOrder::m_nAmount [private]

Definition at line 106 of file StandingOrder.h.

unsigned int Model::CStandingOrder::m_nInterval [private]

Definition at line 109 of file StandingOrder.h.

CString Model::CStandingOrder::m_strSubject [private]

Definition at line 112 of file StandingOrder.h.

CString Model::CStandingOrder::m_strSource [private]

Definition at line 115 of file StandingOrder.h.

CString Model::CStandingOrder::m_strRecipient [private]

Definition at line 118 of file StandingOrder.h.

The documentation for this class was generated from the following files:
  • StandingOrder.h
  • StandingOrder.cpp


View::CStandingOrderDialog Class Reference

A dialog to create/edit CStandingOrder. More...

#include <StandingOrderDialog.h>

Inheritance diagram for View::CStandingOrderDialog::

CDialog List of all members.

Public Types

enum | { IDD = IDD_STANDINGORDER }
ID of the used dialog resource. More...

Public Methods

CStandingOrderDialog (bool bInitialize=false, CWnd *pParent=NULL)
constructor. More...

Public Attributes

BOOL | m_bProved
value of "proved" checkbox control. More...

BOOL | m_bSigned
value of "signed" checkbox control. More...

CString | m_strAlterationDate
value of "alteration date" control. More...

int | m_nAmount
value of "amount" edit control. More...

CString | m_strAuthor
value of "author" edit control. More...

CString | m_strDateOfFoundation
value of "date of foundation" control. More...

CString | m_strFormality
value of "formality" edit control. More...

int | m_nInterval
value of "interval" edit control. More...

CString | m_strKey
value of "key" edit control. More...

CString | m_strRecipient
value of "recipient" edit control. More...

CString | m_strSource
value of "source" edit control. More...

CString | m_strSubject
value of "subject" edit control. More...

CString | m_strTitle
value of "title" edit control. More...

Protected Methods

virtual void | DoDataExchange (CDataExchange *pDX)
data exchange. More...

void | OnChange ()
virtual BOOL | OnInitDialog ()
initialize dialog controls. More...

virtual void | OnOK ()
validate controls and close dialog. More...

Protected Attributes

bool | m_bInitialize
true, if used to construct a new CStandingOrder (enable more controls). More...

bool | m_bModified

Detailed Description

Author:
Stephan Brumme
Date:
August 11, 2001
Invariant:
  • each CString attribute must be non-empty
  • m_nAmount and m_nInterval must be positive
  • invariant is verified by OnOK

Definition at line 24 of file StandingOrderDialog.h.

Member Enumeration Documentation

anonymous enum

Enumeration values:
IDD

Definition at line 32 of file StandingOrderDialog.h.

00032 { IDD = IDD_STANDINGORDER };

Constructor & Destructor Documentation

View::CStandingOrderDialog::CStandingOrderDialog | ( | bool | bInitialize = false,
 |  | CWnd * | pParent = NULL
 | ) |

Initialize all dialog controls and get dialog mode (create or edit CStandingOrder)

Parameters:
bInitialize | true, if used to create a new CStandingOrder
pParent | handle of the parent window (not used)

Definition at line 26 of file StandingOrderDialog.cpp.

00027     : CDialog(CStandingOrderDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CStandingOrderDialog)
00030     m_bProved = FALSE;
00031     m_bSigned = FALSE;
00032     m_strAlterationDate = _T("");
00033     m_nAmount = 0;
00034     m_strAuthor = _T("");
00035     m_strDateOfFoundation = _T("");
00036     m_strFormality = _T("");
00037     m_nInterval = 0;
00038     m_strKey = _T("");
00039     m_strRecipient = _T("");
00040     m_strSource = _T("");
00041     m_strSubject = _T("");
00042     m_strTitle = _T("");
00043     //}}AFX_DATA_INIT
00044
00045     m_bInitialize = bInitialize;
00046     m_bModified   = false;
00047 }

Member Function Documentation

void View::CStandingOrderDialog::DoDataExchange ( CDataExchange * pDX ) [protected, virtual]

Transfer data from the dialog controls to this class' member variables (and vice versa). Whole code is generated by wizards

Parameters:
pDX data exchange object
See also:
OnOK

Definition at line 56 of file StandingOrderDialog.cpp.

00057 {
00058     CDialog::DoDataExchange(pDX);
00059     //{{AFX_DATA_MAP(CStandingOrderDialog)
00060     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00061     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00062     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00063     DDX_Text(pDX, IDC_EDIT_AMOUNT, m_nAmount);
00064     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00065     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00066     DDX_Text(pDX, IDC_EDIT_FORMALITY, m_strFormality);
00067     DDX_Text(pDX, IDC_EDIT_INTERVAL, m_nInterval);
00068     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00069     DDX_Text(pDX, IDC_EDIT_RECIPIENT, m_strRecipient);
00070     DDX_Text(pDX, IDC_EDIT_SOURCE, m_strSource);
00071     DDX_Text(pDX, IDC_EDIT_SUBJECT, m_strSubject);
00072     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00073     //}}AFX_DATA_MAP
00074 }

void View::CStandingOrderDialog::OnChange ( ) [protected]

Definition at line 188 of file StandingOrderDialog.cpp.

00189 {
00190     m_bModified = true;
00191 }

BOOL View::CStandingOrderDialog::OnInitDialog ( ) [protected, virtual]

Enable/disable dialog controls to differ between creation and edit mode

See also:
CStandingOrderDialog()

Definition at line 82 of file StandingOrderDialog.cpp.

00083 {
00084     CDialog::OnInitDialog();
00085
00086     // controls are only writeable if used for construction of a new object
00087     if (m_bInitialize)
00088     {
00089         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00090         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00091         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00092         ((CEdit*)GetDlgItem(IDC_EDIT_FORMALITY))->SetReadOnly(FALSE);
00093         ((CEdit*)GetDlgItem(IDC_EDIT_SOURCE   ))->SetReadOnly(FALSE);
00094         ((CEdit*)GetDlgItem(IDC_EDIT_RECIPIENT))->SetReadOnly(FALSE);
00095         ((CEdit*)GetDlgItem(IDC_EDIT_SUBJECT  ))->SetReadOnly(FALSE);
00096
00097         // set cursor to title edit control
00098         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00099
00100         // disallow MFC to change the focus we set
00101         return FALSE;
00102     }
00103
00104     // done, MFC may automatically set focus according to tab order
00105     return TRUE;
00106 }

void View::CStandingOrderDialog::OnOK ( ) [protected, virtual]

Verify control's values and exit if all are valid

See also:
DoDataExchange

Definition at line 113 of file StandingOrderDialog.cpp.

00114 {
00115     // data exchange
00116     UpdateData();
00117
00118     // validate m_strTitle
00119     if (m_strTitle.IsEmpty())
00120     {
00121         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00122         return;
00123     }
00124
00125     // validate m_strAuthor
00126     if (m_strAuthor.IsEmpty())
00127     {
00128         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00129         return;
00130     }
00131
00132     // validate m_strKey
00133     if (m_strKey.IsEmpty())
00134     {
00135         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00136         return;
00137     }
00138
00139     // validate m_strFormality
00140     if (m_strFormality.IsEmpty())
00141     {
00142         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00143         return;
00144     }
00145
00146     // validate m_strSource
00147     if (m_strSource.IsEmpty())
00148     {
00149         AfxMessageBox("Bitte geben Sie einen Einzahler ein.");
00150         return;
00151     }
00152
00153     // validate m_strRecipient
00154     if (m_strRecipient.IsEmpty())
00155     {
00156         AfxMessageBox("Bitte geben Sie einen Empfänger ein.");
00157         return;
00158     }
00159
00160     // validate m_strSubject
00161     if (m_strSubject.IsEmpty())
00162     {
00163         AfxMessageBox("Bitte geben Sie einen Betreff ein.");
00164         return;
00165     }
00166
00167     // validate m_nAmount
00168     if (m_nAmount <= 0)
00169     {
00170         AfxMessageBox("Bitte geben Sie eine positive Summe ein.");
00171         return;
00172     }
00173
00174     // validate m_nInterval
00175     if (m_nInterval <= 0)
00176     {
00177         AfxMessageBox("Bitte geben Sie einen positiven Intervall ein.");
00178         return;
00179     }
00180
00181     // done
00182     if (m_bModified)
00183         CDialog::OnOK();
00184     else
00185         CDialog::OnCancel();
00186 }

Member Data Documentation

BOOL View::CStandingOrderDialog::m_bProved

Definition at line 35 of file StandingOrderDialog.h.

BOOL View::CStandingOrderDialog::m_bSigned

Definition at line 38 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strAlterationDate

Definition at line 41 of file StandingOrderDialog.h.

int View::CStandingOrderDialog::m_nAmount

Definition at line 44 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strAuthor

Definition at line 47 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strDateOfFoundation

Definition at line 50 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strFormality

Definition at line 53 of file StandingOrderDialog.h.

int View::CStandingOrderDialog::m_nInterval

Definition at line 56 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strKey

Definition at line 59 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strRecipient

Definition at line 62 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strSource

Definition at line 65 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strSubject

Definition at line 68 of file StandingOrderDialog.h.

CString View::CStandingOrderDialog::m_strTitle

Definition at line 71 of file StandingOrderDialog.h.

bool View::CStandingOrderDialog::m_bInitialize [protected]

Definition at line 86 of file StandingOrderDialog.h.

bool View::CStandingOrderDialog::m_bModified [protected]

Definition at line 88 of file StandingOrderDialog.h.

The documentation for this class was generated from the following files:
  • StandingOrderDialog.h
  • StandingOrderDialog.cpp


Debug::CTrace Class Reference

Generic debug info class. More...

#include <Trace.h>

List of all members.

Public Methods

CTrace (const char *strMethod, const CObject *pObject=NULL, const CObject *pParam=NULL)
constructor. More...

virtual | ~CTrace ()
destructor. More...

Static Public Attributes

bool | m_bObjectDump = false
dump the whole object each time. More...

bool | m_bParamDump = false
dump the parameter in the constructor. More...

Protected Attributes

CString | m_strMethod
name of the calling method. More...

const CObject * | m_pObject
calling object. More...

Detailed Description

  • encapsulates TRACE
Author:
Stephan Brumme
Date:
August 21, 2001
Invariant:
  • (none)

Definition at line 25 of file Trace.h.

Constructor & Destructor Documentation

Debug::CTrace::CTrace | ( | const char * | strMethod,
 |  | const CObject * | pObject = NULL,
 |  | const CObject * | pParam = NULL
 | ) |

Initial TRACE

Parameters:
strMethod | name of the calling method
pObject | pointer to the calling object
pParam | parameter of the calling method (only for dumps)

Definition at line 25 of file Trace.cpp.

00026 {
00027     // only compiled in DEBUG build
00028 #ifdef _DEBUG
00029     // copy parameters
00030     m_strMethod = strMethod;
00031     m_pObject   = pObject;
00032
00033     // valid object ?
00034     if (m_pObject)
00035     {
00036         // display classname
00037         TRACE("%s::", m_pObject->GetRuntimeClass()->m_lpszClassName);
00038         // verify object assertions
00039         ASSERT_VALID(m_pObject);
00040
00041         // dump if neccessary
00042         if (m_bObjectDump)
00043             //m_pObject->Dump(afxDump);
00044             TRACE("OBJECT DUMP DISABLED TO AVOID MEMORY OVERFLOW !!!\n");
00045     }
00046
00047     // display method name
00048     TRACE("%s", m_strMethod);
00049
00050     // TRACE and ASSERT parameter
00051     if (pParam)
00052     {
00053         TRACE("(%s)", pParam->GetRuntimeClass()->m_lpszClassName);
00054         ASSERT_VALID(pParam);
00055
00056         // dump if neccessary
00057         if (m_bParamDump)
00058             pParam->Dump(afxDump);
00059     }
00060
00061     TRACE(" entered ...");
00062 #endif
00063 }

Debug::CTrace::~CTrace ( ) [virtual]

Finishing TRACE and ASSERT

Definition at line 69 of file Trace.cpp.

00070 {
00071     // only compiled in DEBUG build
00072 #ifdef _DEBUG
00073     TRACE("leaving %s\n", m_strMethod);
00074     if (m_pObject)
00075         ASSERT_VALID(m_pObject);
00076 #endif
00077 }

Member Data Documentation

bool Debug::CTrace::m_bObjectDump = false [static]

Definition at line 15 of file Trace.cpp.

bool Debug::CTrace::m_bParamDump = false [static]

Definition at line 16 of file Trace.cpp.

CString Debug::CTrace::m_strMethod [protected]

Definition at line 46 of file Trace.h.

const CObject* Debug::CTrace::m_pObject [protected]

Definition at line 49 of file Trace.h.

The documentation for this class was generated from the following files:
  • Trace.h
  • Trace.cpp


CWinApp Class Reference

Inheritance diagram for CWinApp::

Application::CPraktikumMFCApp
The documentation for this class was generated from the following file:
  • PraktikumMFC.h


Hierarchical Index

Praktikum MFC Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:
  • CDialog
    • Debug::CDumpDialog
    • View::CAboutDialog
    • View::CBankDocumentDialog
    • View::CContractDialog
    • View::CFolderDialog
    • View::CFormDialog
    • View::CStandingOrderDialog
  • CDocument
    • Model::CPraktikumMFCDoc
  • CFile
    • Debug::CFileTrace
  • CListView
    • View::CPraktikumMFCView
  • CMDIChildWnd
    • Controller::CChildFrame
  • CMDIFrameWnd
    • Controller::CMainFrame
  • CObject
    • CMyDate
    • Model::CBankDocument
      • Model::CContract
      • Model::CForm
        • Model::CStandingOrder
    • Model::CPolymorphicSet< C >
    • Model::CPolymorphicSet< CBankDocument >
      • Model::CFolder
  • Debug::CScenario
  • Debug::CTrace
  • CWinApp
    • Application::CPraktikumMFCApp


Compound Member Index

Praktikum MFC Compound Members

a | c | d | e | f | g | h | i | j | k | m | n | o | p | s | w | ~

Here is a list of all class members with links to the class documentation for each member:

- a -

  • ActivateFrame() : Controller::CChildFrame
  • AddDebug() : Application::CPraktikumMFCApp
  • APRIL : CMyDate
  • AssertValid() : Model::CStandingOrder, Model::CPolymorphicSet< C >, CMyDate, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument
  • AUGUST : CMyDate
  • autoInit : Debug::CFileTrace

- c -
  • CAboutDialog() : View::CAboutDialog
  • Card() : Model::CPolymorphicSet< C >
  • CBankDocument() : Model::CBankDocument
  • CBankDocumentDialog() : View::CBankDocumentDialog
  • CChildFrame() : Controller::CChildFrame
  • CContract() : Model::CContract
  • CContractDialog() : View::CContractDialog
  • CDumpDialog() : Debug::CDumpDialog
  • CFileTrace() : Debug::CFileTrace
  • CFolder() : Model::CFolder
  • CFolderDialog() : View::CFolderDialog
  • CForm() : Model::CForm
  • CFormDialog() : View::CFormDialog
  • Clone() : Model::CPolymorphicSet< C >
  • CMainFrame() : Controller::CMainFrame
  • CMyDate() : CMyDate
  • Copyequalvalue() : Debug::CScenario
  • CopyequalvalueFolder() : Debug::CScenario
  • CPolymorphicSet() : Model::CPolymorphicSet< C >
  • CPraktikumMFCApp() : Application::CPraktikumMFCApp
  • CPraktikumMFCDoc() : Model::CPraktikumMFCDoc
  • CPraktikumMFCView() : View::CPraktikumMFCView
  • CStandingOrder() : Model::CStandingOrder
  • CStandingOrderDialog() : View::CStandingOrderDialog
  • CTrace() : Debug::CTrace

- d -
  • DECEMBER : CMyDate
  • DeleteAll() : Model::CPraktikumMFCDoc
  • DeleteContents() : Model::CPraktikumMFCDoc
  • DeleteEntry() : Model::CPraktikumMFCDoc
  • DoDataExchange() : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, Debug::CDumpDialog, View::CContractDialog, View::CBankDocumentDialog, View::CAboutDialog
  • Dump() : Model::CStandingOrder, Model::CPolymorphicSet< C >, CMyDate, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument

- e -
  • EditEntry() : Model::CPraktikumMFCDoc
  • Equal() : Model::CPolymorphicSet< C >, Model::CBankDocument
  • EqualKey() : Model::CBankDocument
  • EqualValue() : Debug::CScenario

- f -
  • FEBRUARY : CMyDate
  • Find() : Debug::CScenario, Model::CPolymorphicSet< C >
  • FindscratchfindFolder() : Debug::CScenario
  • Format() : CMyDate

- g -
  • Generate() : Model::CStandingOrder, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument
  • GenerateC() : Model::CStandingOrder, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument
  • GetAlterationDate() : Model::CForm, Model::CContract
  • GetAmount() : Model::CStandingOrder
  • GetAuthor() : Model::CBankDocument
  • GetCurrent() : Model::CPolymorphicSet< C >, CMyDate
  • GetCustomerInformation() : Model::CFolder
  • GetDateOfFoundation() : Model::CFolder, Model::CBankDocument
  • GetDay() : CMyDate
  • GetDocument() : View::CPraktikumMFCView
  • GetFirst() : Model::CPolymorphicSet< C >
  • GetFormality() : Model::CForm
  • GetHour() : CMyDate
  • GetInterval() : Model::CStandingOrder
  • GetKey() : Model::CBankDocument
  • GetMinute() : CMyDate
  • GetMonth() : CMyDate
  • GetNext() : Model::CPolymorphicSet< C >
  • GetProved() : Model::CForm, Model::CContract
  • GetRecipient() : Model::CStandingOrder
  • GetRegistrationNumber() : Model::CContract
  • GetSecond() : CMyDate
  • GetSigned() : Model::CForm, Model::CContract
  • GetSource() : Model::CStandingOrder
  • GetSubject() : Model::CStandingOrder
  • GetTitle() : Model::CBankDocument
  • GetWording() : Model::CContract
  • GetYear() : CMyDate

- h -
  • HasChanged() : Model::CForm, Model::CContract

- i -
  • IDD : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, Debug::CDumpDialog, View::CContractDialog, View::CBankDocumentDialog, View::CAboutDialog
  • Init() : Debug::CFileTrace
  • InitInstance() : Application::CPraktikumMFCApp
  • Insert() : Debug::CScenario, Model::CPolymorphicSet< C >
  • InsertBankdocument() : Model::CPraktikumMFCDoc
  • InsertcardFolder() : Debug::CScenario
  • InsertContract() : Model::CPraktikumMFCDoc
  • InsertfindgetcurrentFolder() : Debug::CScenario
  • InsertForm() : Model::CPraktikumMFCDoc
  • InsertStandingorder() : Model::CPraktikumMFCDoc
  • IsDebug() : Application::CPraktikumMFCApp
  • IsLeapYear() : CMyDate

- j -
  • JANUARY : CMyDate
  • JULY : CMyDate
  • JUNE : CMyDate

- k -
  • KeyOf() : Model::CStandingOrder, CMyDate, Model::CForm, Model::CContract, Model::CBankDocument

- m -
  • m_bActivated : Controller::CChildFrame
  • m_bInitialize : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, View::CContractDialog, View::CBankDocumentDialog
  • m_bModified : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog
  • m_bObjectDump : Debug::CTrace, Debug::CDumpDialog
  • m_bParamDump : Debug::CTrace
  • m_bParameterDump : Debug::CDumpDialog
  • m_bProved : View::CStandingOrderDialog, View::CFormDialog, Model::CForm, View::CContractDialog, Model::CContract
  • m_bSigned : View::CStandingOrderDialog, View::CFormDialog, Model::CForm, View::CContractDialog, Model::CContract
  • m_Cursor : Model::CPolymorphicSet< C >
  • m_dtAlterationDate : Model::CForm, Model::CContract
  • m_dtDateOfFoundation : Model::CFolder, Model::CBankDocument
  • m_Folder : Model::CPraktikumMFCDoc
  • m_nAmount : View::CStandingOrderDialog, Model::CStandingOrder
  • m_nCardinality : View::CFolderDialog
  • m_nDay : CMyDate
  • m_nHour : CMyDate
  • m_nInterval : View::CStandingOrderDialog, Model::CStandingOrder
  • m_nMinute : CMyDate
  • m_nMonth : CMyDate
  • m_nRegistrationNumber : View::CContractDialog, Model::CContract
  • m_nSecond : CMyDate
  • m_nYear : CMyDate
  • m_pDumpDialog : Application::CPraktikumMFCApp
  • m_pObject : Debug::CTrace
  • m_Set : Model::CPolymorphicSet< C >
  • m_strAlterationDate : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog
  • m_strAuthor : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog, View::CBankDocumentDialog, Model::CBankDocument
  • m_strCustomerInformation : View::CFolderDialog, Model::CFolder
  • m_strDateOfFoundation : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, View::CContractDialog, View::CBankDocumentDialog
  • m_strDump : Debug::CDumpDialog
  • m_strFormality : View::CStandingOrderDialog, View::CFormDialog, Model::CForm
  • m_strKey : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog, View::CBankDocumentDialog, Model::CBankDocument
  • m_strMethod : Debug::CTrace
  • m_strRecipient : View::CStandingOrderDialog, Model::CStandingOrder
  • m_strSource : View::CStandingOrderDialog, Model::CStandingOrder
  • m_strSubject : View::CStandingOrderDialog, Model::CStandingOrder
  • m_strTitle : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog, View::CBankDocumentDialog, Model::CBankDocument
  • m_strWording : View::CContractDialog, Model::CContract
  • MARCH : CMyDate
  • MAY : CMyDate

- n -
  • NOVEMBER : CMyDate

- o -
  • OCTOBER : CMyDate
  • OnAppAbout() : Application::CPraktikumMFCApp
  • OnButtonDelete() : Debug::CDumpDialog
  • OnCancel() : Debug::CDumpDialog
  • OnChange() : View::CStandingOrderDialog, View::CFormDialog, View::CContractDialog, View::CBankDocumentDialog
  • OnChangea() : View::CContractDialog
  • OnCheckObjectdump() : Debug::CDumpDialog
  • OnCheckParameterdump() : Debug::CDumpDialog
  • OnContextMenu() : View::CPraktikumMFCView
  • OnCreate() : View::CPraktikumMFCView
  • OnDblclk() : View::CPraktikumMFCView
  • OnDeleteAll() : View::CPraktikumMFCView
  • OnDeleteCursor() : View::CPraktikumMFCView
  • OnDraw() : View::CPraktikumMFCView
  • OnHelp() : Application::CPraktikumMFCApp
  • OnInitDialog() : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, Debug::CDumpDialog, View::CContractDialog, View::CBankDocumentDialog
  • OnInsertBankdocument() : View::CPraktikumMFCView
  • OnInsertContract() : View::CPraktikumMFCView
  • OnInsertForm() : View::CPraktikumMFCView
  • OnInsertStandingorder() : View::CPraktikumMFCView
  • OnNewDocument() : Model::CPraktikumMFCDoc
  • OnOK() : View::CStandingOrderDialog, View::CFormDialog, View::CFolderDialog, Debug::CDumpDialog, View::CContractDialog, View::CBankDocumentDialog
  • OnPressedReturn() : View::CPraktikumMFCView
  • OnScenarioCopyequalvalue() : View::CPraktikumMFCView
  • OnScenarioCopyequalvalueFolder() : View::CPraktikumMFCView
  • OnScenarioEqualValue() : View::CPraktikumMFCView
  • OnScenarioFind() : View::CPraktikumMFCView
  • OnScenarioFindscratchfindFolder() : View::CPraktikumMFCView
  • OnScenarioInsert() : View::CPraktikumMFCView
  • OnScenarioInsertcardFolder() : View::CPraktikumMFCView
  • OnScenarioInsertfindgetcurrentFolder() : View::CPraktikumMFCView
  • OnScenarioScratchcardFolder() : View::CPraktikumMFCView
  • OnShowCursor() : View::CPraktikumMFCView
  • OnShowCustomerinformation() : View::CPraktikumMFCView
  • OnShowDebug() : View::CPraktikumMFCView, Application::CPraktikumMFCApp
  • OnShowDebugCurrent() : View::CPraktikumMFCView
  • OnUpdate() : View::CPraktikumMFCView
  • OnUpdateDeleteAll() : View::CPraktikumMFCView
  • OnUpdateDeleteCursor() : View::CPraktikumMFCView
  • OnUpdateScenario() : View::CPraktikumMFCView
  • OnUpdateShowCursor() : View::CPraktikumMFCView
  • OnUpdateShowDebug() : View::CPraktikumMFCView
  • OnUpdateWindowDebug() : View::CPraktikumMFCView
  • OnWindowDebug() : View::CPraktikumMFCView
  • OnWWW() : Application::CPraktikumMFCApp
  • operator CString() : CMyDate
  • operator CTime() : CMyDate
  • operator=() : Model::CStandingOrder, Model::CPolymorphicSet< C >, CMyDate, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument
  • operator==() : Model::CStandingOrder, Model::CPolymorphicSet< C >, CMyDate, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument

- p -
  • PreCreateWindow() : View::CPraktikumMFCView, Controller::CMainFrame

- s -
  • Scratch() : Model::CPolymorphicSet< C >
  • ScratchAll() : Model::CPolymorphicSet< C >
  • ScratchcardFolder() : Debug::CScenario
  • SEPTEMBER : CMyDate
  • Serialize() : Model::CStandingOrder, Model::CPraktikumMFCDoc, Model::CPolymorphicSet< C >, CMyDate, Model::CForm, Model::CFolder, Model::CContract, Model::CBankDocument
  • SetAmount() : Model::CStandingOrder
  • SetCursor() : Model::CPolymorphicSet< C >
  • SetDay() : CMyDate
  • SetHour() : CMyDate
  • SetInterval() : Model::CStandingOrder
  • SetMinute() : CMyDate
  • SetMonth() : CMyDate
  • SetProved() : Model::CForm, Model::CContract
  • SetSecond() : CMyDate
  • SetSigned() : Model::CForm, Model::CContract
  • SetWording() : Model::CContract
  • SetYear() : CMyDate
  • ShowCustomerinformation() : Model::CPraktikumMFCDoc

- w -
  • Write() : Debug::CFileTrace

- ~ -
  • ~CBankDocument() : Model::CBankDocument
  • ~CContract() : Model::CContract
  • ~CFolder() : Model::CFolder
  • ~CForm() : Model::CForm
  • ~CMyDate() : CMyDate
  • ~CPolymorphicSet() : Model::CPolymorphicSet< C >
  • ~CPraktikumMFCApp() : Application::CPraktikumMFCApp
  • ~CPraktikumMFCDoc() : Model::CPraktikumMFCDoc
  • ~CStandingOrder() : Model::CStandingOrder
  • ~CTrace() : Debug::CTrace


Namespace Index

Praktikum MFC Namespace List

Here is a list of all namespaces with brief descriptions:
  • Application (Application of the MVC concept)
  • Controller (Controller of the MVC concept)
  • Debug (Gathers all Debug information)
  • Model (Namespace that contains all model classes)
  • View (View of the MVC concept)


Application Namespace Reference

Application of the MVC concept. More...

Compounds

class Application::CPraktikumMFCApp
The main class. More...

Variables

CPraktikumMFCApp theApp
the one and only application object. More...

Detailed Description

Combines Model, View and Controller

Variable Documentation

CPraktikumMFCApp Application::theApp

Definition at line 36 of file PraktikumMFC.cpp.


Controller Namespace Reference

Controller of the MVC concept. More...

Compounds

class | Controller::CChildFrame
The MDI child frame. More...

class | Controller::CMainFrame
The MDI main frame. More...

Detailed Description

Coordinates data flow between user, Model and View


Debug Namespace Reference

Gathers all Debug information. More...

Compounds

class | Debug::CDumpDialog
A modeless dialog that displays DEBUG output. More...

class | Debug::CFileTrace
CFileTrace is a CFile that "writes" to the trace window.

class | Debug::CScenario
Generate scenarios. More...

class | Debug::CTrace
Generic debug info class. More...

Variables

void(* | Print )(const char *)
function pointer that gets all Debug output. More...

Variable Documentation

void (* Debug::Print)(const char*) [static]

Definition at line 43 of file FileTrace.h.

Referenced by Debug::CFileTrace::Write().


Model Namespace Reference

Namespace that contains all model classes. More...

Compounds

class | Model::CBankDocument
A basic bank document. More...

class | Model::CContract
A contract. More...

class | Model::CFolder
A folder. More...

class | Model::CForm
A form. More...

class | Model::CPolymorphicSet
Template of a polymorphic set. More...

class | Model::CPraktikumMFCDoc
The main document. More...

class | Model::CStandingOrder
A standing order. More...

Detailed Description

  • Model component of the MVC concept


View Namespace Reference

View of the MVC concept. More...

Compounds

class | View::CAboutDialog
A dialog that displays some general info. More...

class | View::CBankDocumentDialog
A dialog to create/display CBankDocument. More...

class | View::CContractDialog
A dialog to create/edit CContract. More...

class | View::CFolderDialog
A dialog to create/display CFolder. More...

class | View::CFormDialog
A dialog to create/edit CForm. More...

class | View::CPraktikumMFCView
The main view. More...

class | View::CStandingOrderDialog
A dialog to create/edit CStandingOrder. More...

Detailed Description

Displays all neccessary parts of the Model


File Member Index

Praktikum MFC File Members

t

Here is a list of all file members with links to the files they belong to:

- t -

  • THIS_FILE : StandingOrderDialog.cpp, StandingOrder.cpp, Scenario.cpp, PraktikumMFCView.cpp, PraktikumMFCDoc.cpp, PraktikumMFC.cpp, MyDate.cpp, MainFrm.cpp, FormDialog.cpp, Form.cpp, FolderDialog.cpp, Folder.cpp, DumpDialog.cpp, ContractDialog.cpp, Contract.cpp, ChildFrm.cpp, BankDocumentDialog.cpp, BankDocument.cpp, AboutDialog.cpp


Namespace Member Index

Praktikum MFC Namespace Members

p | t

Here is a list of all namespace members with links to the namespace documentation for each member:

- p -

  • Print : Debug

- t -
  • theApp : Application


Page Index

Praktikum MFC Related Pages

Here is a list of all related documentation pages:
  • Test List


Test List
Member Debug::CScenario::Copyequalvalue(CFolder &m_Folder, int nEntry)
Case 1 of all documents: copy a document and compare copy/original document
Attention:
always true !
Member Debug::CScenario::CopyequalvalueFolder(CFolder &m_Folder)
Case 1 (CFolder): copy a folder and compare copy/original folder
Attention:
always true !
Member Debug::CScenario::EqualValue(CFolder &m_Folder, int nEntry)
Create a copy and slightly change date of foundation
Attention:
always true, because date of foundation is not used for comparisons !
Member Debug::CScenario::Find(CFolder &m_Folder, int nEntry)
Find an already existing document of the set
Attention:
always true !
Member Debug::CScenario::FindscratchfindFolder(CFolder &m_Folder, int nEntry)
Case 3 (CFolder): Find a document, scratch it and search for it again
Attention:
fails always !
Member Debug::CScenario::Insert(CFolder &m_Folder, int nEntry)
Insert an already document into the set
Attention:
fails always !
Member Debug::CScenario::InsertcardFolder(CFolder &m_Folder, int nEntry)
Case 4 (CFolder): Insert a new document - cardinality must increase by 1
Attention:
always true !
Member Debug::CScenario::InsertfindgetcurrentFolder(CFolder &m_Folder, int nEntry)
Case 2 (CFolder): Insert a document into the set, find and retrieve it, compare it to the original
Attention:
always true !
Member Debug::CScenario::ScratchcardFolder(CFolder &m_Folder, int nEntry)
Case 5 (CFolder): Scratch current document - cardinality must decrease by 1
Attention:
always true !


AboutDialog.cpp Source File

AboutDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  AboutDialog.cpp
00005     \brief class CAboutDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "AboutDialog.h"
00011
00012 #ifdef _DEBUG
00013 #undef THIS_FILE
00014 static char THIS_FILE[]=__FILE__;
00015 #define new DEBUG_NEW
00016 #endif
00017
00018 namespace View
00019 {
00020
00021 /*!
00022     Route dialog ID down to CDialog
00023 */
00024 CAboutDialog::CAboutDialog() : CDialog(CAboutDialog::IDD)
00025 {
00026     //{{AFX_DATA_INIT(CAboutDialog)
00027     //}}AFX_DATA_INIT
00028 }
00029
00030
00031 /*
00032     Transfer data from the dialog controls to this class' member variables (and vice versa).
00033     Whole code is generated by wizards. Not actually required because no controls were defined
00034 */
00035 void CAboutDialog::DoDataExchange(CDataExchange* pDX)
00036 {
00037     CDialog::DoDataExchange(pDX);
00038     //{{AFX_DATA_MAP(CAboutDialog)
00039     //}}AFX_DATA_MAP
00040 }
00041
00042
00043 BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
00044     //{{AFX_MSG_MAP(CAboutDialog)
00045     //}}AFX_MSG_MAP
00046 END_MESSAGE_MAP()
00047
00048 } // namespace View


AboutDialog.h Source File

AboutDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  AboutDialog.h
00005     \brief class CAboutDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog that displays some general info
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li (none)
00019 */
00020
00021 //##ModelId=3B863B04037A
00022 class CAboutDialog : public CDialog
00023 {
00024 public:
00025     //! constructor
00026     //##ModelId=3B863B04037F
00027     CAboutDialog();
00028
00029     //{{AFX_DATA(CAboutDialog)
00030     //! ID of the used dialog resource
00031     enum { IDD = IDD_ABOUTBOX };
00032     //}}AFX_DATA
00033
00034     //{{AFX_VIRTUAL(CAboutDialog)
00035     protected:
00036     //! data exchange
00037     //##ModelId=3B863B04037C
00038     virtual void DoDataExchange(CDataExchange* pDX);
00039     //}}AFX_VIRTUAL
00040
00041 protected:
00042     //{{AFX_MSG(CAboutDialog)
00043     //}}AFX_MSG
00044     DECLARE_MESSAGE_MAP()
00045 };
00046
00047 } // namespace View


BankDocument.cpp Source File

BankDocument.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  BankDocument.cpp
00005     \brief class CBankDocument (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "BankDocument.h"
00010
00011 #ifdef _DEBUG
00012 #undef THIS_FILE
00013 static char THIS_FILE[]=__FILE__;
00014 #define new DEBUG_NEW
00015 #endif
00016
00017
00018
00019 namespace Model
00020 {
00021
00022 /*!
00023     Constructs a new bank document with the current date/time
00024     \see CMyDate()
00025 */
00026 CBankDocument::CBankDocument()
00027 {
00028     m_dtDateOfFoundation = CMyDate();
00029 }
00030
00031
00032 /*!
00033     Copies an existing CBankDocument
00034     \param bankdocument bank document to be copied
00035     \see operator=
00036 */
00037 CBankDocument::CBankDocument(const CBankDocument& bankdocument)
00038 {
00039     operator=(bankdocument);
00040 }
00041
00042
00043 /*!
00044     Constructs a new bank document using given author, title and key
00045     \param strAuthor author
00046     \param strTitle  title
00047     \param strKey    key
00048 */
00049 CBankDocument::CBankDocument(CString strAuthor, CString strTitle, CString strKey)
00050 {
00051     // copy parameters
00052     m_strAuthor = strAuthor;
00053     m_strTitle  = strTitle;
00054     m_strKey    = strKey;
00055     // refresh date
00056     m_dtDateOfFoundation = CMyDate();
00057 }
00058
00059
00060 /*!
00061     No clean-up required
00062 */
00063 CBankDocument::~CBankDocument()
00064 {
00065 }
00066
00067
00068 /*!
00069     Create a new non-initialized object
00070     \return new instance of CBankDocument
00071 */
00072 CObject* CBankDocument::Generate() const
00073 {
00074     return new CBankDocument;
00075 }
00076
00077
00078 /*!
00079     Clone this object
00080     \return exact copy
00081 */
00082 CObject* CBankDocument::GenerateC() const
00083 {
00084     return new CBankDocument(*this);
00085 }
00086
00087
00088 /*!
00089     Loads/stores CBankDocument
00090     \param ar CArchive that provides data persistency
00091 */
00092 void CBankDocument::Serialize(CArchive &ar)
00093 {
00094     CObject::Serialize(ar);
00095
00096     if (ar.IsStoring())
00097         ar << m_strAuthor << m_strTitle << m_strKey;
00098     else
00099         ar >> m_strAuthor >> m_strTitle >> m_strKey;
00100
00101     // << and >> operators are not overloaded
00102     m_dtDateOfFoundation.Serialize(ar);
00103 }
00104
00105
00106 /*!
00107     Determines whether the bank document is valid,
00108     \b invariant describes further details (see above)
00109 */
00110 void CBankDocument::AssertValid() const
00111 {
00112     CObject::AssertValid();
00113
00114     ASSERT(!m_strAuthor.IsEmpty());
00115     ASSERT(!m_strTitle .IsEmpty());
00116     ASSERT(!m_strKey   .IsEmpty());
00117
00118     ASSERT_VALID(&m_dtDateOfFoundation);
00119 }
00120
00121
00122 /*!
00123     Create a dump of the class (only DEBUG version)
00124     \param dc output dump stream
00125 */
00126 void CBankDocument::Dump(CDumpContext& dc) const
00127 {
00128     CObject::Dump(dc);
00129
00130     dc << "author: " << m_strAuthor << "\n"
00131        << "title:  " << m_strTitle  << "\n"
00132        << "key:    " << m_strKey    << "\n"
00133        << "date:   ";
00134     // << operator is not overloaded
00135     m_dtDateOfFoundation.Dump(dc);
00136 }
00137
00138
00139 /*!
00140     Copies all attributes
00141     \param  bankdocument CBankDocument that should be copied
00142     \return reference to the copied bank document
00143 */
00144 CBankDocument& CBankDocument::operator = (const CBankDocument& bankdocument)
00145 {
00146     // copy attributes
00147     m_strAuthor = bankdocument.m_strAuthor;
00148     m_strTitle  = bankdocument.m_strTitle;
00149     m_strKey    = bankdocument.m_strKey;
00150     m_dtDateOfFoundation = bankdocument.m_dtDateOfFoundation;
00151
00152     return *this;
00153 }
00154
00155
00156 /*!
00157     Compare attributes (except key) of two bank documents
00158     \param  bankdocument CBankDocument that we compare to
00159     \return true, if all attributes are equal
00160 */
00161 bool CBankDocument::operator ==(const CBankDocument& bankdocument) const
00162 {
00163     return (m_strAuthor == bankdocument.m_strAuthor &&
00164             m_strTitle  == bankdocument.m_strTitle  &&
00165             m_strKey    == bankdocument.m_strKey    );
00166 //            m_dtDateOfFoundation == bankdocument.m_dtDateOfFoundation);
00167 }
00168
00169
00170 /*!
00171     Compare keys
00172     \param bankdocument CBankDocument that we compare to
00173     \return true, if keys are equal
00174 */
00175 bool CBankDocument::EqualKey(const CBankDocument& bankdocument) const
00176 {
00177     return (KeyOf() == bankdocument.KeyOf());
00178 }
00179
00180
00181 /*!
00182     Check for object identity
00183     \param object object that we compare to
00184     \return true, if both objects are identical
00185 */
00186 bool CBankDocument::Equal(const CObject* object) const
00187 {
00188     return (this == object);
00189 }
00190
00191
00192 /*!
00193     Responsible for the generation of a unique key based on the object's attributes
00194     \return CString that contains the key
00195 */
00196 CString CBankDocument::KeyOf() const
00197 {
00198     CString strKey;
00199     strKey.Format("[%s|%s|%s|%s|%p]", m_strAuthor, m_strTitle,  m_strKey,
00200                                       m_dtDateOfFoundation.KeyOf(),
00201                                       this);
00202     return strKey;
00203 }
00204
00205
00206 /*!
00207     Get author
00208     \return author
00209 */
00210 CString CBankDocument::GetAuthor() const
00211 {
00212     return m_strAuthor;
00213 }
00214 /*!
00215     Get title
00216     \return title
00217 */
00218 CString CBankDocument::GetTitle() const
00219 {
00220     return m_strTitle;
00221 }
00222 /*!
00223     Get key
00224     \return key
00225 */
00226 CString CBankDocument::GetKey() const
00227 {
00228     return m_strKey;
00229 }
00230 /*!
00231     Get date of foundation
00232     \return date of foundation
00233 */
00234 CMyDate CBankDocument::GetDateOfFoundation() const
00235 {
00236     return m_dtDateOfFoundation;
00237 }
00238
00239
00240
00241 // serializable
00242 IMPLEMENT_SERIAL(CBankDocument, CObject, 1)
00243
00244 }


BankDocument.h Source File

BankDocument.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  BankDocument.h
00005     \brief class CBankDocument (interface)
00006 */
00007
00008 #include "MyDate.h"
00009 #pragma once
00010
00011 namespace Model
00012 {
00013
00014 //! A basic bank document
00015 /*! \li base class for all other bank-related classes
00016
00017     \author         Stephan Brumme
00018     \date           August 23, 2001
00019
00020     \invariant
00021     \li each CString attribute must be non-empty
00022     \li m_dtDateOfFoundation must be valid
00023 */
00024
00025 //##ModelId=3B863B040230
00026 class CBankDocument : public CObject
00027 {
00028 public:
00029     //! default constructor
00030     //##ModelId=3B863B0402D4
00031     CBankDocument();
00032     //! copy constructor
00033     //##ModelId=3B863B0402D5
00034     CBankDocument(const CBankDocument& bankdocument);
00035     //! explicitly set author, title and key
00036     //##ModelId=3B863B0402D7
00037     CBankDocument(CString strAuthor, CString strTitle, CString strKey);
00038
00039     //! destructor
00040     //##ModelId=3B863B0402D2
00041     virtual ~CBankDocument();
00042
00043     //! create a new object
00044     //##ModelId=3B863B0402D0
00045     virtual CObject* Generate () const;
00046     //! clone this object
00047     //##ModelId=3B863B0402AD
00048     virtual CObject* GenerateC() const;
00049     //! serialization
00050     //##ModelId=3B863B0402AA
00051     virtual void Serialize(CArchive &ar);
00052     //! validate the folder
00053     //##ModelId=3B863B0402A8
00054     virtual void AssertValid() const;
00055     //! dump
00056     //##ModelId=3B863B0402A5
00057     virtual void Dump(CDumpContext& dc) const;
00058
00059     //! copy
00060     //##ModelId=3B863B0402A2
00061     virtual CBankDocument& operator = (const CBankDocument& bankdocument);
00062     //! compare value
00063     //##ModelId=3B863B04029F
00064     virtual bool           operator ==(const CBankDocument& bankdocument) const;
00065     //! compare keys
00066     //##ModelId=3B863B04026F
00067     bool EqualKey   (const CBankDocument& bankdocument) const;
00068     //! check for identity
00069     //##ModelId=3B863B04026C
00070     bool Equal(const CObject* object) const;
00071
00072     //! deliver a unique identifier
00073     //##ModelId=3B863B04026A
00074     virtual CString KeyOf() const;
00075
00076     //! get author
00077     //##ModelId=3B863B040268
00078     CString GetAuthor() const;
00079     //! get title
00080     //##ModelId=3B863B040266
00081     CString GetTitle()  const;
00082     //! get key
00083     //##ModelId=3B863B040264
00084     CString GetKey()    const;
00085     //! get date of foundation
00086     //##ModelId=3B863B040262
00087     CMyDate GetDateOfFoundation() const;
00088
00089 private:
00090     //! author
00091     //##ModelId=3B88C0FF0078
00092     CString m_strAuthor;
00093     //! title
00094     //##ModelId=3B88C0FF003D
00095     CString m_strTitle;
00096     //! key
00097     //##ModelId=3B88C0FF003C
00098     CString m_strKey;
00099     //! date of foundation
00100     //##ModelId=3B863B040234
00101     CMyDate m_dtDateOfFoundation;
00102
00103
00104     DECLARE_SERIAL(CBankDocument)
00105 };
00106
00107 } // namespace Model


BankDocumentDialog.cpp Source File

BankDocumentDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  BankDocumentDialog.cpp
00005     \brief class CBankDocumentDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "BankDocumentDialog.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 namespace View
00019 {
00020
00021 /*!
00022     Initialize all dialog controls and get dialog mode (create or display CBankDocument)
00023     \param bInitialize true, if used to create a new CBankDocument
00024     \param pParent handle of the parent window (not used)
00025 */
00026 CBankDocumentDialog::CBankDocumentDialog(bool bInitialize, CWnd* pParent /*=NULL*/)
00027     : CDialog(CBankDocumentDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CBankDocumentDialog)
00030     m_strAuthor = _T("");
00031     m_strDateOfFoundation = _T("");
00032     m_strKey = _T("");
00033     m_strTitle = _T("");
00034     //}}AFX_DATA_INIT
00035
00036     m_bInitialize = bInitialize;
00037 }
00038
00039
00040 /*!
00041     Transfer data from the dialog controls to this class' member variables (and vice versa).
00042     Whole code is generated by wizards
00043     \param pDX data exchange object
00044     \see OnOK
00045 */
00046 void CBankDocumentDialog::DoDataExchange(CDataExchange* pDX)
00047 {
00048     CDialog::DoDataExchange(pDX);
00049     //{{AFX_DATA_MAP(CBankDocumentDialog)
00050     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00051     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00052     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00053     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00054     //}}AFX_DATA_MAP
00055 }
00056
00057
00058 /*!
00059     Enable/disable dialog controls to differ between creation and display mode
00060     \see CBankDocumentDialog()
00061 */
00062 BOOL CBankDocumentDialog::OnInitDialog()
00063 {
00064     CDialog::OnInitDialog();
00065
00066     // controls are only writeable if used for construction of a new object
00067     if (m_bInitialize)
00068     {
00069         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetReadOnly(FALSE);
00070         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR))->SetReadOnly(FALSE);
00071         ((CEdit*)GetDlgItem(IDC_EDIT_KEY   ))->SetReadOnly(FALSE);
00072
00073         // set cursor to title edit control
00074         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00075
00076         // disallow MFC to change the focus we set
00077         return FALSE;
00078     }
00079
00080     // done, MFC may automatically set focus according to tab order
00081     return TRUE;
00082 }
00083
00084
00085 /*!
00086     Verify control's values and exit if all are valid
00087     \see DoDataExchange
00088 */
00089 void CBankDocumentDialog::OnOK()
00090 {
00091     // data exchange
00092     UpdateData();
00093
00094     // validate m_strTitle
00095     if (m_strTitle.IsEmpty())
00096     {
00097         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00098         return;
00099     }
00100
00101     // validate m_strAuthor
00102     if (m_strAuthor.IsEmpty())
00103     {
00104         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00105         return;
00106     }
00107
00108     // validate m_strKey
00109     if (m_strKey.IsEmpty())
00110     {
00111         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00112         return;
00113     }
00114
00115     // done
00116     CDialog::OnOK();
00117 }
00118
00119
00120 /*!
00121     No user defined messages defined
00122 */
00123 BEGIN_MESSAGE_MAP(CBankDocumentDialog, CDialog)
00124     //{{AFX_MSG_MAP(CBankDocumentDialog)
00125     //}}AFX_MSG_MAP
00126 END_MESSAGE_MAP()
00127
00128 } // namespace View


BankDocumentDialog.h Source File

BankDocumentDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  BankDocumentDialog.h
00005     \brief class CBankDocumentDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog to create/display CBankDocument
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li each CString attribute must be non-empty
00019     \li invariant is verified by OnOK
00020 */
00021
00022 //##ModelId=3B863B0202EE
00023 class CBankDocumentDialog : public CDialog
00024 {
00025 public:
00026     //! constructor
00027     CBankDocumentDialog(bool bInitialize = false, CWnd* pParent = NULL);
00028
00029     //{{AFX_DATA(CBankDocumentDialog)
00030     //! ID of the used dialog resource
00031     enum { IDD = IDD_BANKDOCUMENT };
00032     //! value of "author" edit control
00033     //##ModelId=3B863B020325
00034     CString m_strAuthor;
00035     //! value of "date of foundation" control
00036     //##ModelId=3B863B020324
00037     CString m_strDateOfFoundation;
00038     //! value of "key" edit control
00039     //##ModelId=3B863B020323
00040     CString m_strKey;
00041     //! value of "title" edit control
00042     //##ModelId=3B863B020322
00043     CString m_strTitle;
00044     //}}AFX_DATA
00045
00046     //{{AFX_VIRTUAL(CBankDocumentDialog)
00047     protected:
00048     //! data exchange
00049     //##ModelId=3B863B02032C
00050     virtual void DoDataExchange(CDataExchange* pDX);
00051     //}}AFX_VIRTUAL
00052
00053 protected:
00054
00055     //! true, if used to construct a new CBankDocument (enable more controls)
00056     //##ModelId=3B863B020321
00057     bool m_bInitialize;
00058
00059     //{{AFX_MSG(CBankDocumentDialog)
00060     //##ModelId=3B863B02032A
00061     virtual BOOL OnInitDialog();
00062     //##ModelId=3B863B020328
00063     virtual void OnOK();
00064     //##ModelId=3B863B020326
00065     afx_msg void OnChange();
00066     //}}AFX_MSG
00067     DECLARE_MESSAGE_MAP()
00068 };
00069
00070 } // namespace View
00071 //{{AFX_INSERT_LOCATION}}


ChildFrm.cpp Source File

ChildFrm.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  ChildFrm.cpp
00005     \brief class CChildFrame (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010
00011 #include "ChildFrm.h"
00012
00013 #ifdef _DEBUG
00014 #define new DEBUG_NEW
00015 #undef THIS_FILE
00016 static char THIS_FILE[] = __FILE__;
00017 #endif
00018
00019
00020 namespace Controller
00021 {
00022
00023 /*!
00024     Window must be created
00025 */
00026 CChildFrame::CChildFrame()
00027 {
00028     m_bActivated = false;
00029 }
00030
00031
00032 /*!
00033     activate child window and maximize if possible
00034     \param nCmdShow window style on activation
00035 */
00036 void CChildFrame::ActivateFrame(int nCmdShow)
00037 {
00038     if (!m_bActivated)
00039     {
00040         m_bActivated = true;
00041         nCmdShow = SW_SHOWMAXIMIZED;
00042     }
00043
00044     CMDIChildWnd::ActivateFrame(nCmdShow);
00045 }
00046
00047
00048 IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
00049
00050 BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
00051     //{{AFX_MSG_MAP(CChildFrame)
00052     //}}AFX_MSG_MAP
00053 END_MESSAGE_MAP()
00054
00055 } // namespace Controller


ChildFrm.h Source File

ChildFrm.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  ChildFrm.h
00005     \brief class CChildFrame (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace Controller
00011 {
00012
00013 //! The MDI child frame
00014 /*! \author         Visual Studio Wizard
00015     \date           August 23, 2001
00016 */
00017
00018 //##ModelId=3B863AFF026C
00019 class CChildFrame : public CMDIChildWnd
00020 {
00021 public:
00022     //! default constructor
00023     /*! nothing left to do */
00024     //##ModelId=3B863AFF02A6
00025     CChildFrame() ;
00026
00027     //{{AFX_VIRTUAL(CChildFrame)
00028     public:
00029     //##ModelId=3B863AFF02A3
00030     virtual void ActivateFrame(int nCmdShow = -1);
00031     //}}AFX_VIRTUAL
00032
00033 protected:
00034     //{{AFX_MSG(CChildFrame)
00035     //}}AFX_MSG
00036
00037     //! true, if window is newly created
00038     //##ModelId=3B863AFF029F
00039     bool m_bActivated;
00040
00041     DECLARE_DYNCREATE(CChildFrame)
00042     DECLARE_MESSAGE_MAP()
00043 };
00044
00045
00046 } // namespace Controller
00047
00048 //{{AFX_INSERT_LOCATION}}
00049


Contract.cpp Source File

Contract.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Contract.cpp
00005     \brief class CContract (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "Contract.h"
00010
00011 #ifdef _DEBUG
00012 #undef THIS_FILE
00013 static char THIS_FILE[]=__FILE__;
00014 #define new DEBUG_NEW
00015 #endif
00016
00017
00018 namespace Model
00019 {
00020
00021 /*!
00022     Constructs a new unproved and unsigned contract
00023 */
00024 CContract::CContract()
00025 {
00026     m_bProved = m_bSigned = false;
00027     m_nRegistrationNumber = 0;
00028 }
00029
00030
00031 /*!
00032     Copies an existing CContract
00033     \param contract contract to be copied
00034     \see operator=
00035 */
00036 CContract::CContract(const CContract& contract)
00037 {
00038     operator=(contract);
00039 }
00040
00041
00042 //! explicitly set attributes
00043 CContract::CContract(CString strAuthor, CString strTitle, CString strKey,
00044            unsigned int nRegistrationNumber, bool bProved, bool bSigned,
00045            CString strWording)
00046          : CBankDocument(strAuthor, strTitle, strKey)
00047 {
00048     m_nRegistrationNumber = nRegistrationNumber;
00049     m_bProved = bProved;
00050     m_bSigned = bSigned;
00051     m_strWording = strWording;
00052     m_dtAlterationDate = CMyDate();
00053 }
00054
00055
00056 /*!
00057     No clean-up required
00058 */
00059 CContract::~CContract()
00060 {
00061 }
00062
00063
00064 /*!
00065     Create a new non-initialized object
00066     \return new instance of CContract
00067 */
00068 CObject* CContract::Generate () const
00069 {
00070     return new CContract;
00071 }
00072
00073
00074 /*!
00075     Clone this object
00076     \return exact copy
00077 */
00078 CObject* CContract::GenerateC() const
00079 {
00080     return new CContract(*this);
00081 }
00082
00083
00084 /*!
00085     Loads/stores CContract
00086     \param ar CArchive that provides data persistency
00087 */
00088 void CContract::Serialize(CArchive &ar)
00089 {
00090     // serialize parent
00091     CBankDocument::Serialize(ar);
00092
00093     // CArchive can't handle "bool" so I have to use "BOOL" (which is "int" ...)
00094     BOOL bProved = m_bProved,
00095          bSigned = m_bSigned;
00096
00097     if (ar.IsStoring())
00098         ar << bProved << bSigned << m_nRegistrationNumber << m_strWording;
00099     else
00100         ar >> bProved >> bSigned >> m_nRegistrationNumber >> m_strWording;
00101
00102     // neccessary because of MFC's "bool!=BOOL story"
00103     m_bProved = (bProved == TRUE);
00104     m_bSigned = (bSigned == TRUE);
00105
00106     // << and >> operators are not overloaded
00107     m_dtAlterationDate.Serialize(ar);
00108 }
00109
00110
00111 /*!
00112     Determines whether the contract is valid,
00113     \b invariant describes further details (see above)
00114 */
00115 void CContract::AssertValid() const
00116 {
00117     CBankDocument::AssertValid();
00118
00119     ASSERT(!m_strWording.IsEmpty());
00120     ASSERT(m_nRegistrationNumber > 0);
00121     ASSERT_VALID(&m_dtAlterationDate);
00122 }
00123
00124
00125 /*!
00126     Create a dump of the class (only DEBUG version)
00127     \param dc output dump stream
00128 */
00129 void CContract::Dump(CDumpContext& dc) const
00130 {
00131     CBankDocument::Dump(dc);
00132
00133     dc << "\n"
00134        << "registration number: " << m_nRegistrationNumber << "\n"
00135        << "proved: " << m_bProved << "\n"
00136        << "signed: " << m_bSigned << "\n"
00137        << "wording: " << m_strWording << "\n"
00138        << "alternation date: ";
00139
00140     m_dtAlterationDate.Dump(dc);
00141 }
00142
00143
00144 /*!
00145     Copies all attributes
00146     \param  contract CContract that should be copied
00147     \return reference to the copied form
00148 */
00149 CContract& CContract::operator = (const CContract& contract)
00150 {
00151     // copy inherited attributes
00152     CBankDocument::operator =(contract);
00153
00154     // copy CContract's attributes
00155     m_bProved = contract.m_bProved;
00156     m_bSigned = contract.m_bSigned;
00157     m_dtAlterationDate    = contract.m_dtAlterationDate;
00158     m_strWording          = contract.m_strWording;
00159     m_nRegistrationNumber = contract.m_nRegistrationNumber;
00160
00161     return *this;
00162 }
00163
00164
00165 /*!
00166     Copies all attributes for polymorphic behaviour
00167     \param  bankdocument CContract (casted as CBankDocument) that should be copied
00168     \return reference to the copied form
00169 */
00170 CBankDocument& CContract::operator = (const CBankDocument& bankdocument)
00171 {
00172     try
00173     {
00174         // copy all attributes
00175         operator =(dynamic_cast<const CContract&>(bankdocument));
00176     }
00177     catch(...)
00178     {
00179         // invalid class
00180 #ifdef _DEBUG
00181         TRACE("Copy denied because of invalid cast (needed a CContract)\n");
00182         Dump(afxDump);
00183         bankdocument.Dump(afxDump);
00184 #endif
00185     }
00186
00187     return *this;
00188 }
00189
00190
00191 /*!
00192     Compare attributes (except key) of two contracts
00193     \param  form CContract that we compare to
00194     \return true, if all attributes are equal
00195 */
00196 bool CContract::operator ==(const CContract& contract) const
00197 {
00198     return (CBankDocument::operator ==(contract) &&
00199             m_bProved == contract.m_bProved &&
00200             m_bSigned == contract.m_bSigned &&
00201 //            m_dtAlterationDate    == contract.m_dtAlterationDate &&
00202             m_strWording          == contract.m_strWording &&
00203             m_nRegistrationNumber == contract.m_nRegistrationNumber);
00204 }
00205
00206
00207 /*!
00208     Compares all attributes for polymorphic behaviour
00209     \param  bankdocument CContract (casted as CBankDocument) that should be compared to
00210     \return true, if all attributes are equal
00211 */
00212 bool CContract::operator ==(const CBankDocument& bankdocument) const
00213 {
00214     try
00215     {
00216         // compare all attributes
00217         return operator ==(dynamic_cast<const CContract&>(bankdocument));
00218     }
00219     catch(...)
00220     {
00221         // invalid class
00222         TRACE("Comparison denied because of invalid cast\n"
00223               "(needed a CContract and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00224 #ifdef _DEBUG
00225         Dump(afxDump);
00226         bankdocument.Dump(afxDump);
00227 #endif
00228     }
00229
00230     return false;
00231 }
00232
00233
00234 /*!
00235     Responsible for the generation of a unique key based on the object's attributes
00236     \return CString that contains the key
00237 */
00238 CString CContract::KeyOf() const
00239 {
00240     CString strKey;
00241     strKey.Format("[%d|%s|%d|%d|%s|%s|%p]", m_nRegistrationNumber,
00242                                             m_strWording, m_bProved,  m_bSigned,
00243                                             m_dtAlterationDate.KeyOf(),
00244                                             CBankDocument::KeyOf(),
00245                                             this);
00246     return strKey;
00247 }
00248
00249
00250 /*!
00251     Get "proved" property
00252     \return true, if form is proved
00253 */
00254 bool CContract::GetProved() const
00255 {
00256     return m_bProved;
00257 }
00258 /*!
00259     Get "signed" property
00260     \return true, if form is signed
00261 */
00262 bool CContract::GetSigned() const
00263 {
00264     return m_bSigned;
00265 }
00266 /*!
00267     Get wording
00268     \return wording
00269 */
00270 CString CContract::GetWording() const
00271 {
00272     return m_strWording;
00273 }
00274 /*!
00275     Get alteration date
00276     \return alteration date
00277 */
00278 CMyDate CContract::GetAlterationDate() const
00279 {
00280     return m_dtAlterationDate;
00281 }
00282 /*!
00283     Get registration number
00284     \return registration number
00285 */
00286 unsigned int CContract::GetRegistrationNumber() const
00287 {
00288     return m_nRegistrationNumber;
00289 }
00290
00291
00292 /*!
00293     Set "proved" property
00294     \param bProved true, if form is proved
00295 */
00296 void CContract::SetProved(bool bProved)
00297 {
00298     m_bProved = bProved;
00299     // update alteration date
00300     HasChanged();
00301 }
00302 /*!
00303     Set "signed" property
00304     \param bSigned true, if form is signed
00305 */
00306 void CContract::SetSigned(bool bSigned)
00307 {
00308     m_bSigned = bSigned;
00309     // update alteration date
00310     HasChanged();
00311 }
00312 /*!
00313     Set wording
00314     \param strWording wording
00315 */
00316 void CContract::SetWording(CString strWording)
00317 {
00318     m_strWording = strWording;
00319     // update alteration date
00320     HasChanged();
00321 }
00322
00323
00324 /*!
00325     Update date of alteration
00326 */
00327 void CContract::HasChanged()
00328 {
00329     m_dtAlterationDate = CMyDate();
00330 }
00331
00332
00333
00334 // serializable
00335 IMPLEMENT_SERIAL(CContract, CBankDocument, 1)
00336
00337 } // namespace Model


Contract.h Source File

Contract.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Contract.h
00005     \brief class CContract (interface)
00006 */
00007
00008 #include "BankDocument.h"
00009 #pragma once
00010
00011 namespace Model
00012 {
00013
00014 //! A contract
00015 /*!
00016     \author         Stephan Brumme
00017     \date           August 23, 2001
00018
00019     \invariant
00020     \li m_nRegistrationNumber is positive
00021     \li m_dtAlterationDate must be valid
00022     \li m_strWording must be non-empty
00023     \li parent class must be valid
00024 */
00025
00026 //##ModelId=3B863AFB0370
00027 class CContract : public CBankDocument
00028 {
00029 public:
00030     //! default constructor
00031     //##ModelId=3B863AFC0042
00032     CContract();
00033     //! copy constructor
00034     //##ModelId=3B863AFC0043
00035     CContract(const CContract& contract);
00036     //! explicitly set attributes
00037     //##ModelId=3B863AFC0065
00038     CContract(CString strAuthor, CString strTitle, CString strKey,
00039               unsigned int nRegistrationNumber, bool bProved, bool bSigned,
00040               CString strWording);
00041
00042     //! destructor
00043     //##ModelId=3B863AFC0040
00044     virtual ~CContract();
00045
00046     //! create a new object
00047     //##ModelId=3B863AFC003E
00048     virtual CObject* Generate () const;
00049     //! clone this object
00050     //##ModelId=3B863AFC003C
00051     virtual CObject* GenerateC() const;
00052     //! serialization
00053     //##ModelId=3B863AFC0039
00054     virtual void Serialize(CArchive &ar);
00055     //! validate the contract
00056     //##ModelId=3B863AFC0037
00057     virtual void AssertValid() const;
00058     //! dump
00059     //##ModelId=3B863AFC0034
00060     virtual void Dump(CDumpContext& dc) const;
00061
00062     //! copy
00063     //##ModelId=3B863AFB03ED
00064             CContract&     operator = (const CContract& contract);
00065     //! polymorphic copy
00066     //##ModelId=3B863AFB03EF
00067     virtual CBankDocument& operator = (const CBankDocument& bankdocument);
00068     //! comparison
00069     //##ModelId=3B863AFB03E7
00070             bool operator ==(const CContract& contract) const;
00071     //! polymorphic comparison
00072     //##ModelId=3B863AFB03EA
00073     virtual bool operator ==(const CBankDocument& bankdocument) const;
00074
00075
00076     //! deliver a unique identifier
00077     //##ModelId=3B863AFB03E5
00078     virtual CString KeyOf() const;
00079
00080     //! determine whether form is proved
00081     //##ModelId=3B863AFB03E3
00082     bool    GetProved()         const;
00083     //! determine whether form is signed
00084     //##ModelId=3B863AFB03E1
00085     bool    GetSigned()         const;
00086     //! get formality
00087     //##ModelId=3B863AFB03DF
00088     CString GetWording()        const;
00089     //! get alteration date
00090     //##ModelId=3B863AFB03B6
00091     CMyDate GetAlterationDate() const;
00092     //! get registration number
00093     //##ModelId=3B863AFB03B4
00094     unsigned int GetRegistrationNumber() const;
00095
00096     //! set "proved" property
00097     //##ModelId=3B863AFB03B2
00098     void    SetProved(bool bProved);
00099     //! set "signed" property
00100     //##ModelId=3B863AFB03B0
00101     void    SetSigned(bool bSigned);
00102     //! set wording
00103     //##ModelId=3B863AFB03AE
00104     void    SetWording(CString strWording);
00105
00106 protected:
00107     //! at least one attribute has changed
00108     //##ModelId=3B863AFB03AD
00109     void HasChanged();
00110
00111 private:
00112     //! registration number
00113     //##ModelId=3B863AFB03AC
00114     unsigned int m_nRegistrationNumber;
00115     //! alteration date
00116     //##ModelId=3B863AFB0375
00117     CMyDate      m_dtAlterationDate;
00118     //! "proved" property
00119     //##ModelId=3B88C0F60303
00120     bool         m_bProved;
00121     //! "signed" property
00122     //##ModelId=3B88C0F60302
00123     bool         m_bSigned;
00124     //! wording
00125     //##ModelId=3B863AFB0372
00126     CString      m_strWording;
00127
00128
00129
00130     DECLARE_SERIAL(CContract)
00131 };
00132
00133 } // namespace Model


ContractDialog.cpp Source File

ContractDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  ContractDialog.cpp
00005     \brief class CContractDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "ContractDialog.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 namespace View
00019 {
00020
00021 /*!
00022     Initialize all dialog controls and get dialog mode (create or edit CContract)
00023     \param bInitialize true, if used to create a new CContract
00024     \param pParent handle of the parent window (not used)
00025 */
00026 CContractDialog::CContractDialog(bool bInitialize, CWnd* pParent /*=NULL*/)
00027     : CDialog(CContractDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CContractDialog)
00030     m_bProved = FALSE;
00031     m_bSigned = FALSE;
00032     m_strAlterationDate = _T("");
00033     m_strAuthor = _T("");
00034     m_strDateOfFoundation = _T("");
00035     m_strKey = _T("");
00036     m_nRegistrationNumber = 0;
00037     m_strTitle = _T("");
00038     m_strWording = _T("");
00039     //}}AFX_DATA_INIT
00040
00041     m_bInitialize = bInitialize;
00042     m_bModified   = false;
00043 }
00044
00045
00046 /*!
00047     Transfer data from the dialog controls to this class' member variables (and vice versa).
00048     Whole code is generated by wizards
00049     \param pDX data exchange object
00050     \see OnOK
00051 */
00052 void CContractDialog::DoDataExchange(CDataExchange* pDX)
00053 {
00054     CDialog::DoDataExchange(pDX);
00055     //{{AFX_DATA_MAP(CContractDialog)
00056     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00057     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00058     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00059     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00060     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00061     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00062     DDX_Text(pDX, IDC_EDIT_REGISTRATIONNUMBER, m_nRegistrationNumber);
00063     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00064     DDX_Text(pDX, IDC_EDIT_WORDING, m_strWording);
00065     //}}AFX_DATA_MAP
00066 }
00067
00068
00069 /*!
00070     Enable/disable dialog controls to differ between creation and edit mode
00071     \see CContractDialog()
00072 */
00073 BOOL CContractDialog::OnInitDialog()
00074 {
00075     CDialog::OnInitDialog();
00076
00077     // controls are only writeable if used for construction of a new object
00078     if (m_bInitialize)
00079     {
00080         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00081         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00082         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00083         ((CEdit*)GetDlgItem(IDC_EDIT_REGISTRATIONNUMBER))->SetReadOnly(FALSE);
00084
00085         // set cursor to title edit control
00086         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00087
00088         // disallow MFC to change the focus we set
00089         return FALSE;
00090     }
00091
00092     // done, MFC may automatically set focus according to tab order
00093     return TRUE;
00094 }
00095
00096
00097 /*!
00098     Verify control's values and exit if all are valid
00099     \see DoDataExchange
00100 */
00101 void CContractDialog::OnOK()
00102 {
00103     // data exchange
00104     UpdateData();
00105
00106     // validate m_strTitle
00107     if (m_strTitle.IsEmpty())
00108     {
00109         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00110         return;
00111     }
00112
00113     // validate m_strAuthor
00114     if (m_strAuthor.IsEmpty())
00115     {
00116         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00117         return;
00118     }
00119
00120     // validate m_strKey
00121     if (m_strKey.IsEmpty())
00122     {
00123         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00124         return;
00125     }
00126
00127     // validate m_strWording
00128     if (m_strWording.IsEmpty())
00129     {
00130         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00131         return;
00132     }
00133
00134     // validate m_nRegistrationNumber
00135     if (m_nRegistrationNumber <= 0)
00136     {
00137         AfxMessageBox("Bitte geben Sie eine positive Registeriernummer ein.");
00138         return;
00139     }
00140
00141     // done
00142     if (m_bModified)
00143         CDialog::OnOK();
00144     else
00145         CDialog::OnCancel();
00146 }
00147
00148 void CContractDialog::OnChange()
00149 {
00150     m_bModified = true;
00151 }
00152
00153
00154 BEGIN_MESSAGE_MAP(CContractDialog, CDialog)
00155     //{{AFX_MSG_MAP(CContractDialog)
00156     ON_BN_CLICKED(IDC_CHECK_PROVED, OnChange)
00157     ON_BN_CLICKED(IDC_CHECK_SIGNED, OnChange)
00158     ON_EN_CHANGE(IDC_EDIT_WORDING, OnChange)
00159     //}}AFX_MSG_MAP
00160 END_MESSAGE_MAP()
00161
00162
00163 } // namespace View


ContractDialog.h Source File

ContractDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  ContractDialog.h
00005     \brief class CContractDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog to create/edit CContract
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li each CString attribute must be non-empty
00019     \li registration number must be positive
00020     \li invariant is verified by OnOK
00021 */
00022
00023 //##ModelId=3B863B0301CC
00024 class CContractDialog : public CDialog
00025 {
00026 public:
00027     //! constructor
00028     CContractDialog(bool bInitialize = false, CWnd* pParent = NULL);
00029
00030     //{{AFX_DATA(CContractDialog)
00031     //! ID of the used dialog resource
00032     enum { IDD = IDD_CONTRACT };
00033     //! value of "proved" checkbox control
00034     //##ModelId=3B863B03020D
00035     BOOL    m_bProved;
00036     //! value of "signed" checkbox control
00037     //##ModelId=3B863B03020C
00038     BOOL    m_bSigned;
00039     //! value of "alteration date" control
00040     //##ModelId=3B863B03020B
00041     CString m_strAlterationDate;
00042     //! value of "author" edit control
00043     //##ModelId=3B863B03020A
00044     CString m_strAuthor;
00045     //! value of "date of foundation" control
00046     //##ModelId=3B863B030209
00047     CString m_strDateOfFoundation;
00048     //! value of "key" edit control
00049     //##ModelId=3B863B030208
00050     CString m_strKey;
00051     //! value of "registration" edit control
00052     //##ModelId=3B863B0301D2
00053     int     m_nRegistrationNumber;
00054     //! value of "title" edit control
00055     //##ModelId=3B863B0301D1
00056     CString m_strTitle;
00057     //! value of "wording" edit control
00058     //##ModelId=3B863B0301D0
00059     CString m_strWording;
00060     //}}AFX_DATA
00061
00062
00063     //{{AFX_VIRTUAL(CContractDialog)
00064     protected:
00065     //! data exchange
00066     //##ModelId=3B863B030215
00067     virtual void DoDataExchange(CDataExchange* pDX);
00068     //}}AFX_VIRTUAL
00069
00070 protected:
00071
00072     //! true, if used to construct a new CContract (enable more controls)
00073     //##ModelId=3B863B0301CF
00074     bool m_bInitialize;
00075     //##ModelId=3B863B0301CE
00076     bool m_bModified;
00077     //##ModelId=3B863B030214
00078     void OnChange();
00079
00080     //{{AFX_MSG(CContractDialog)
00081     //##ModelId=3B863B030212
00082     virtual BOOL OnInitDialog();
00083     //##ModelId=3B863B030210
00084     virtual void OnOK();
00085     //##ModelId=3B863B03020E
00086     afx_msg void OnChangea();
00087     //}}AFX_MSG
00088     DECLARE_MESSAGE_MAP()
00089 };
00090
00091 } // namespace View
00092
00093 //{{AFX_INSERT_LOCATION}}
00094


DumpDialog.cpp Source File

DumpDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  DumpDialog.cpp
00005     \brief class CDumpDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "DumpDialog.h"
00011 #include "Trace.h"
00012
00013 #ifdef _DEBUG
00014 #define new DEBUG_NEW
00015 #undef THIS_FILE
00016 static char THIS_FILE[] = __FILE__;
00017 #endif
00018
00019
00020 namespace Debug
00021 {
00022
00023 /*!
00024     Initialize Dialog
00025     \param pParent handle of the parent window (not used)
00026 */
00027 CDumpDialog::CDumpDialog(CWnd* pParent /*=NULL*/)
00028     : CDialog(CDumpDialog::IDD, pParent)
00029 {
00030     //{{AFX_DATA_INIT(CDumpDialog)
00031     m_strDump = _T("");
00032     m_bObjectDump = CTrace::m_bObjectDump;
00033     m_bParameterDump = CTrace::m_bParamDump;
00034     //}}AFX_DATA_INIT
00035 }
00036
00037
00038 /*!
00039     Set window style attributes (transparency)
00040 */
00041 BOOL CDumpDialog::OnInitDialog()
00042 {
00043     CDialog::OnInitDialog();
00044
00045     // code taken from "Windows 2000 Systemprogrammierung" p. 87 by Ron Nanko
00046 //  SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
00047 //  SetLayeredWindowAttributes(m_hWnd, 0, (255*90)/100, LWA_ALPHA);
00048
00049     return TRUE;  // return TRUE unless you set the focus to a control
00050                   // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
00051 }
00052
00053
00054 /*!
00055     Transfer data from the dialog controls to this class' member variables (and vice versa).
00056     Whole code is generated by wizards
00057     \param pDX data exchange object
00058 */
00059 void CDumpDialog::DoDataExchange(CDataExchange* pDX)
00060 {
00061     CDialog::DoDataExchange(pDX);
00062     //{{AFX_DATA_MAP(CDumpDialog)
00063     DDX_Text(pDX, IDC_EDIT_DUMP, m_strDump);
00064     DDX_Check(pDX, IDC_CHECK_OBJECTDUMP, m_bObjectDump);
00065     DDX_Check(pDX, IDC_CHECK_PARAMETERDUMP, m_bParameterDump);
00066     //}}AFX_DATA_MAP
00067 }
00068
00069
00070 /*!
00071     Overridden to avoid closing the dialog
00072 */
00073 void CDumpDialog::OnCancel()
00074 {
00075 }
00076
00077
00078 /*!
00079     Save whole protocol to disc
00080 */
00081 void CDumpDialog::OnOK()
00082 {
00083     // accepted file extensions
00084     const char strFilter[] = "Protokolldateien (*.log)|*.log|Alle Dateien (*.*)|*.*|";
00085     // "save" dialog
00086     CFileDialog dlg(FALSE, ".log", "*.log", NULL, strFilter, NULL);
00087
00088     if (dlg.DoModal() == IDOK)
00089     {
00090         // text file, overwrite if neccessary
00091         CStdioFile fFile(dlg.GetPathName(), CFile::modeCreate | CFile::modeWrite);
00092
00093         // windows-style CRLF
00094         CString strNoCRLF(m_strDump);
00095         strNoCRLF.Replace("\r", "");
00096
00097         // write it to disc
00098         fFile.WriteString(strNoCRLF);
00099
00100         // user feedback
00101         AfxMessageBox("Protokoll gespeichert.", MB_ICONINFORMATION);
00102     }
00103 }
00104
00105
00106 /*!
00107     Clear protocol
00108 */
00109 void CDumpDialog::OnButtonDelete()
00110 {
00111     m_strDump = "";
00112     UpdateData(FALSE);
00113 }
00114
00115
00116 void CDumpDialog::OnCheckObjectdump()
00117 {
00118     UpdateData(TRUE);
00119     CTrace::m_bObjectDump = (m_bObjectDump == TRUE);
00120 }
00121
00122 void CDumpDialog::OnCheckParameterdump()
00123 {
00124     UpdateData(TRUE);
00125     CTrace::m_bParamDump = (m_bParameterDump == TRUE);
00126 }
00127
00128
00129 BEGIN_MESSAGE_MAP(CDumpDialog, CDialog)
00130     //{{AFX_MSG_MAP(CDumpDialog)
00131     ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
00132     ON_BN_CLICKED(IDC_CHECK_OBJECTDUMP, OnCheckObjectdump)
00133     ON_BN_CLICKED(IDC_CHECK_PARAMETERDUMP, OnCheckParameterdump)
00134     //}}AFX_MSG_MAP
00135 END_MESSAGE_MAP()
00136
00137 } // namespace Debug
00138
00139


DumpDialog.h Source File

DumpDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  DumpDialog.h
00005     \brief class Debug::CDumpDialog (interface)
00006 */
00007
00008 #pragma once
00009 #include "Folder.h"
00010
00011 namespace Debug
00012 {
00013
00014 //! A modeless dialog that displays DEBUG output
00015 /*! \author         Stephan Brumme
00016     \date           August 21, 2001
00017
00018     \invariant
00019     \li (none)
00020 */
00021
00022 //##ModelId=3B863AFC01EA
00023 class CDumpDialog : public CDialog
00024 {
00025 public:
00026     //! constructor
00027     //##ModelId=3B863AFC0224
00028     CDumpDialog(CWnd* pParent = NULL);
00029     //{{AFX_DATA(CDumpDialog)
00030     enum { IDD = IDD_DEBUG };
00031     //##ModelId=3B863AFC01EE
00032     CString m_strDump;
00033     //##ModelId=3B863AFC01ED
00034     BOOL    m_bObjectDump;
00035     //##ModelId=3B863AFC01EC
00036     BOOL    m_bParameterDump;
00037     //}}AFX_DATA
00038
00039     /*! \var m_strDump whole dump information */
00040
00041     //{{AFX_VIRTUAL(CDumpDialog)
00042     protected:
00043     //##ModelId=3B863AFC0221
00044     virtual void DoDataExchange(CDataExchange* pDX);
00045     //}}AFX_VIRTUAL
00046
00047 protected:
00048
00049     //{{AFX_MSG(CDumpDialog)
00050     //##ModelId=3B863AFC021F
00051     virtual void OnCancel();
00052     //##ModelId=3B863AFC021D
00053     virtual void OnOK();
00054     //##ModelId=3B863AFC01F5
00055     afx_msg void OnButtonDelete();
00056     //##ModelId=3B863AFC01F3
00057     afx_msg void OnCheckObjectdump();
00058     //##ModelId=3B863AFC01F1
00059     afx_msg void OnCheckParameterdump();
00060     //##ModelId=3B863AFC01EF
00061     virtual BOOL OnInitDialog();
00062     //}}AFX_MSG
00063     DECLARE_MESSAGE_MAP()
00064 };
00065
00066 } // namespace Debug
00067
00068 //{{AFX_INSERT_LOCATION}}
00069


FileTrace.h Source File

FileTrace.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  FileTrace.h
00005     \brief class Debug::CFileTrace (interface+implementation)
00006
00007     \author         Stephan Brumme and Paul DiLascia
00008     \date           August 18, 2001
00009 */
00010
00011 ////////////////////////////////////////////////////////////////
00012 //
00013 // minor changes by Stephan Brumme
00014 //
00015 // now the original copyright:
00016 //
00017 // TraceWin Copyright 1995-1999 Paul DiLascia
00018 // If this program works, it was written by Paul DiLascia.
00019 // If not, I don't know who wrote it.
00020 //
00021 // ***************************************************************************
00022 // TraceWin is a tool that displays MFC diagnostic (afxDump, TRACE) output.
00023 //
00024 // To use TraceWin, you must #include this file somewhere in your main program
00025 // file (typically where you implement your CWinApp). Since this file contains
00026 // code, you should #include it in only once--i.e. NOT in StdAfx.h--or you'll
00027 // get multiply-defined symbol errors in the linker. This file contains an
00028 // auto-initializing static variable that works in most cases; but you may miss
00029 // some TRACE output from constructors of static objects.
00030 //
00031 // ***************************************************************************
00032 //
00033
00034 #pragma once
00035
00036 // only in Debug build
00037 #ifdef _DEBUG
00038
00039 namespace Debug
00040 {
00041
00042 //! function pointer that gets all Debug output
00043 static void (*Print)(const char*);
00044
00045 //! CFileTrace is a CFile that "writes" to the trace window
00046 //##ModelId=3B863AFF037A
00047 class CFileTrace : public CFile {
00048 private:
00049     //! default constructor
00050     //##ModelId=3B863AFF03B6
00051     CFileTrace();
00052
00053     //! true, if CFileTrace is successfully invoked
00054     //##ModelId=3B863AFF037C
00055     static BOOL autoInit;
00056     //! overwrite output writer
00057     //##ModelId=3B863AFF037F
00058     virtual void Write(const void* lpBuf, UINT nCount);
00059
00060 public:
00061     //! initialize this class as a singleton
00062     //##ModelId=3B863AFF037D
00063     static BOOL Init();
00064
00065     DECLARE_DYNAMIC(CFileTrace)
00066 };
00067
00068
00069 /*!
00070     Set attributes
00071 */
00072 CFileTrace::CFileTrace()
00073 {
00074     // stream name
00075     m_strFileName = _T("CFileTrace");
00076     // no output function defined
00077     Print = NULL;
00078 }
00079
00080 /*!
00081     Override to write to debug window instead of file.
00082     \param lpBuf pointer to the debug output
00083     \param nCount number of bytes in lpBuf
00084     \see CFile
00085 */
00086 void CFileTrace::Write(const void* lpBuf, UINT nCount)
00087 {
00088     // MFC tracing not enabled ?
00089     if (!afxTraceEnabled)
00090         return;
00091
00092     // only redirect if user defined output function is defined
00093     if (Print)
00094     {
00095         static char mybuf[2048];
00096
00097         // copy buffer
00098         memcpy(mybuf, lpBuf, nCount);
00099
00100         // create a CString
00101         CString strDebug(mybuf, nCount);
00102         // and print it
00103         Print(strDebug);
00104     }
00105
00106     // Also do normal debug thing
00107     ::OutputDebugString((LPCTSTR)lpBuf);
00108 }
00109
00110
00111 /*!
00112     Initialize tracing. Replace global afxDump.m_pFile with CFileTrace object.
00113 */
00114 BOOL CFileTrace::Init()
00115 {
00116     if (afxDump.m_pFile==NULL) {
00117         // Initialize tracing: replace afxDump.m_pFile w/ my own CFile object
00118         //
00119         // It's important to allocate with "new" here, not a static object,
00120         // because CFileTrace is virtual--i.e., called through a pointer in
00121         // the object's vtbl--and the compiler will zero out the virtual
00122         // function table with a NOP function when a static object
00123         // goes out of scope. But I want my CFileTrace to stay around to
00124         // display memory leak diagnostics even after all static objects
00125         // have been destructed. So I allocate the object with new and
00126         // never delete it. I don't want this allocation to itself generate
00127         // a reported memory leak, so I turn off memory tracking before I
00128         // allocate, then on again after.
00129         //
00130         BOOL bEnable = AfxEnableMemoryTracking(FALSE);
00131         afxDump.m_pFile = new CFileTrace;
00132         AfxEnableMemoryTracking(bEnable);
00133         return TRUE;
00134     }
00135     return FALSE;
00136 }
00137
00138
00139 //////////////////
00140 // This object does nothing but call CFileTrace::Init, so all you have to
00141 // do is #include this file. Because afxDump is defined in a module with
00142 //
00143 // #pragma init_seg(lib)
00144 //
00145 // afxDump gets initialized before the "user" segment which is where your
00146 // app (and autoInit) is by default. If you need to use init_seg(lib),
00147 // or you have other objects whose constructors call TRACE that get
00148 // initialized before CFileTrace::bInitialized, you will have to call
00149 // CFileTrace::Init yourself, before your first TRACE statement.
00150 //
00151 BOOL CFileTrace::autoInit = CFileTrace::Init();
00152
00153 IMPLEMENT_DYNAMIC(CFileTrace, CFile)
00154
00155 } // namespace Debug
00156
00157 #endif


Folder.cpp Source File

Folder.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Folder.cpp
00005     \brief class CFolder (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009
00010 #include "MyDate.h"
00011 #include "Folder.h"
00012
00013 #ifdef _DEBUG
00014 #undef THIS_FILE
00015 static char THIS_FILE[]=__FILE__;
00016 #define new DEBUG_NEW
00017 #endif
00018
00019
00020 namespace Model
00021 {
00022
00023 /*!
00024     Default constructor
00025 */
00026 CFolder::CFolder()
00027 {
00028     m_strCustomerInformation = "(neu)";
00029 }
00030
00031
00032 /*!
00033     Copy constructor
00034     \param folder CFolder to be copied
00035 */
00036 CFolder::CFolder(const CFolder &folder)
00037 {
00038     operator=(folder);
00039 }
00040
00041
00042 /*!
00043     Initialize using customer information
00044     \param strCustomerInformation customer information
00045 */
00046 CFolder::CFolder(CString strCustomerInformation)
00047 {
00048     m_strCustomerInformation = strCustomerInformation;
00049 }
00050
00051
00052 /*!
00053     Nothing left to do
00054 */
00055 CFolder::~CFolder()
00056 {
00057 }
00058
00059
00060 /*!
00061     Create a new non-initialized object
00062     \return new instance of CFolder
00063 */
00064 CObject* CFolder::Generate () const
00065 {
00066     return new CFolder;
00067 }
00068
00069
00070 /*!
00071     Clone this object
00072     \return exact copy
00073 */
00074 CObject* CFolder::GenerateC() const
00075 {
00076     return new CFolder(*this);
00077 }
00078
00079
00080 /*!
00081     Loads/stores CFolder
00082     \param ar CArchive that provides data persistency
00083 */
00084 void CFolder::Serialize(CArchive &ar)
00085 {
00086     // serialize parent
00087     CPolymorphicSet<CBankDocument>::Serialize(ar);
00088
00089
00090     if (ar.IsStoring())
00091         ar << m_strCustomerInformation;
00092     else
00093         ar >> m_strCustomerInformation;
00094
00095     m_dtDateOfFoundation.Serialize(ar);
00096 }
00097
00098
00099 /*!
00100     Determines whether the foolder is valid,
00101     \b invariant describes further details (see above)
00102 */
00103 void CFolder::AssertValid() const
00104 {
00105     CPolymorphicSet<CBankDocument>::AssertValid();
00106
00107     ASSERT(!m_strCustomerInformation.IsEmpty());
00108     ASSERT_VALID(&m_dtDateOfFoundation);
00109 }
00110
00111
00112 /*!
00113     Create a dump of the class (only DEBUG version)
00114     \param dc output dump stream
00115 */
00116 void CFolder::Dump(CDumpContext& dc) const
00117 {
00118     CPolymorphicSet<CBankDocument>::Dump(dc);
00119
00120     dc << "customer information: " << m_strCustomerInformation << "\n"
00121        << "date of foundation: ";
00122
00123     m_dtDateOfFoundation.Dump(dc);
00124 }
00125
00126
00127 /*!
00128     Copies all attributes
00129     \param  set set that will be copied
00130     \return reference to the current set
00131 */
00132 CFolder& CFolder::operator=(const CFolder& set)
00133 {
00134     m_dtDateOfFoundation     = set.m_dtDateOfFoundation;
00135     m_strCustomerInformation = set.m_strCustomerInformation;
00136
00137     CPolymorphicSet<CBankDocument>::operator=(set);
00138
00139     return *this;
00140 }
00141
00142
00143 /*!
00144     Compares all elements of two sets by value regardless their positions within the set.
00145     The cursors are not compared and may differ therefore
00146     \param  set set to compare to
00147     \return true, if both set are equal
00148     \pre    parameter "set" must be valid
00149 */
00150 bool CFolder::operator==(const CFolder& set) const
00151 {
00152    return (CPolymorphicSet<CBankDocument>::operator==(set) &&
00153            m_strCustomerInformation == set.m_strCustomerInformation);
00154 }
00155
00156
00157 /*!
00158     Get date of foundation
00159     \return date of foundation
00160 */
00161 CMyDate CFolder::GetDateOfFoundation() const
00162 {
00163     return m_dtDateOfFoundation;
00164 }
00165
00166
00167 /*!
00168     Get customer information
00169     \return customer information
00170 */
00171 CString CFolder::GetCustomerInformation() const
00172 {
00173     return m_strCustomerInformation;
00174 }
00175
00176
00177 // serializable
00178 IMPLEMENT_SERIAL(CFolder, CObject, 1)
00179
00180 } // namespace Model


Folder.h Source File

Folder.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Folder.h
00005     \brief class CFolder (interface)
00006 */
00007
00008 #pragma once
00009 #include "PolymorphicSet.h"
00010 #include "BankDocument.h"
00011
00012 namespace Model
00013 {
00014
00015 //! A folder
00016 /*!
00017     \author         Stephan Brumme
00018     \date           August 23, 2001
00019
00020     \invariant
00021     \li date of foundation must be valid
00022     \li customer information must be non-empty
00023     \li parent class must be valid
00024 */
00025
00026 //##ModelId=3B863B000294
00027 class CFolder : public CPolymorphicSet<CBankDocument>
00028 {
00029 public:
00030     //! default constructor
00031     //##ModelId=3B863B000342
00032     CFolder();
00033     //! copy constructor
00034     //##ModelId=3B863B000343
00035     CFolder(const CFolder& folder);
00036     //! explicitly set attributes
00037     //##ModelId=3B863B000345
00038     CFolder(CString strCustomerInformation);
00039
00040     //! destructor
00041     //##ModelId=3B863B000340
00042     virtual ~CFolder();
00043
00044     //! create a new object
00045     //##ModelId=3B863B00033E
00046     virtual CObject* Generate () const;
00047     //! clone this object
00048     //##ModelId=3B863B00033C
00049     virtual CObject* GenerateC() const;
00050     //! serialization
00051     //##ModelId=3B863B000339
00052     virtual void Serialize(CArchive &ar);
00053     //! validate the form
00054     //##ModelId=3B863B000337
00055     virtual void AssertValid() const;
00056     //! dump
00057     //##ModelId=3B863B000334
00058     virtual void Dump(CDumpContext& dc) const;
00059
00060     //! copy the whole set
00061     //##ModelId=3B863B00030F
00062     virtual CFolder& operator=(const CFolder& set);
00063     //! compare two sets
00064     //##ModelId=3B863B00030C
00065     virtual bool operator==(const CFolder& set) const;
00066
00067     //! get date of foundation
00068     //##ModelId=3B863B00030A
00069     CMyDate GetDateOfFoundation()    const;
00070     //! get customer information
00071     //##ModelId=3B863B000308
00072     CString GetCustomerInformation() const;
00073
00074 private:
00075     //! customer information
00076     //##ModelId=3B863B000307
00077     CString m_strCustomerInformation;
00078     //! date of foundation
00079     //##ModelId=3B863B000304
00080     CMyDate m_dtDateOfFoundation;
00081
00082
00083     DECLARE_SERIAL(CFolder)
00084 };
00085
00086 } // namespace Model


FolderDialog.cpp Source File

FolderDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  FolderDialog.cpp
00005     \brief class CFolderDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "FolderDialog.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 namespace View
00019 {
00020
00021 /*!
00022     Initialize all dialog controls and get dialog mode (create or display CFolder)
00023     \param bInitialize true, if used to create a new CFolder
00024     \param pParent handle of the parent window (not used)
00025 */
00026 CFolderDialog::CFolderDialog(bool bInitialize, CWnd* pParent /*=NULL*/)
00027     : CDialog(CFolderDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CFolderDialog)
00030     m_nCardinality = 0;
00031     m_strCustomerInformation = _T("");
00032     m_strDateOfFoundation = _T("");
00033     //}}AFX_DATA_INIT
00034
00035     m_bInitialize = bInitialize;
00036 }
00037
00038
00039 /*!
00040     Transfer data from the dialog controls to this class' member variables (and vice versa).
00041     Whole code is generated by wizards
00042     \param pDX data exchange object
00043     \see OnOK
00044 */
00045 void CFolderDialog::DoDataExchange(CDataExchange* pDX)
00046 {
00047     CDialog::DoDataExchange(pDX);
00048     //{{AFX_DATA_MAP(CFolderDialog)
00049     DDX_Text(pDX, IDC_EDIT_CARDINALITY, m_nCardinality);
00050     DDX_Text(pDX, IDC_EDIT_CUSTOMERINFORMATION, m_strCustomerInformation);
00051     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00052     //}}AFX_DATA_MAP
00053 }
00054
00055
00056 /*!
00057     Enable/disable dialog controls to differ between creation and display mode
00058     \see CFolderDialog()
00059 */
00060 BOOL CFolderDialog::OnInitDialog()
00061 {
00062     CDialog::OnInitDialog();
00063
00064     // controls are only writeable if used for construction of a new object
00065     if (m_bInitialize)
00066     {
00067         ((CEdit*)GetDlgItem(IDC_EDIT_CUSTOMERINFORMATION))->SetReadOnly(FALSE);
00068         ((CEdit*)GetDlgItem(IDC_EDIT_CUSTOMERINFORMATION))->SetFocus();
00069
00070         // disallow MFC to change the focus we set
00071         return FALSE;
00072     }
00073
00074     // done, MFC may automatically set focus according to tab order
00075     return TRUE;
00076 }
00077
00078
00079 /*!
00080     Verify control's values and exit if all are valid
00081     \see DoDataExchange
00082 */
00083 void CFolderDialog::OnOK()
00084 {
00085     // data exchange
00086     UpdateData();
00087
00088     // validate m_strCustomerInformation
00089     if (!m_strCustomerInformation.IsEmpty())
00090         CDialog::OnOK();
00091     else
00092         AfxMessageBox("Die Kundeninformation darf nicht leer sein.", MB_ICONSTOP);
00093 }
00094
00095
00096
00097 BEGIN_MESSAGE_MAP(CFolderDialog, CDialog)
00098     //{{AFX_MSG_MAP(CFolderDialog)
00099     //}}AFX_MSG_MAP
00100 END_MESSAGE_MAP()
00101
00102 } // namespace View


FolderDialog.h Source File

FolderDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  FolderDialog.h
00005     \brief class CFolderDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog to create/display CFolder
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li customer information must be non-empty
00019     \li invariant is verified by OnOK
00020 */
00021
00022 //##ModelId=3B863B020212
00023 class CFolderDialog : public CDialog
00024 {
00025 public:
00026     //! constructor
00027     CFolderDialog(bool bInitialize = false, CWnd* pParent = NULL);
00028
00029     //{{AFX_DATA(CFolderDialog)
00030     //! ID of the used dialog resource
00031     enum { IDD = IDD_FOLDER };
00032     //! value of "cardinality" control
00033     //##ModelId=3B863B020217
00034     int     m_nCardinality;
00035     //! value of "customer information" edit control
00036     //##ModelId=3B863B020216
00037     CString m_strCustomerInformation;
00038     //! value of "date of foundation" control
00039     //##ModelId=3B863B020215
00040     CString m_strDateOfFoundation;
00041     //}}AFX_DATA
00042
00043     //{{AFX_VIRTUAL(CFolderDialog)
00044     protected:
00045     //! data exchange
00046     //##ModelId=3B863B020248
00047     virtual void DoDataExchange(CDataExchange* pDX);
00048     //}}AFX_VIRTUAL
00049
00050 protected:
00051
00052     //##ModelId=3B863B020214
00053     bool m_bInitialize;
00054
00055     //{{AFX_MSG(CFolderDialog)
00056     //! initialize dialog controls
00057     //##ModelId=3B863B020246
00058     virtual BOOL OnInitDialog();
00059     //! validate controls and close dialog
00060     //##ModelId=3B863B020244
00061     virtual void OnOK();
00062     //}}AFX_MSG
00063     DECLARE_MESSAGE_MAP()
00064 };
00065
00066 } // namespace View
00067
00068 //{{AFX_INSERT_LOCATION}}


Form.cpp Source File

Form.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Form.cpp
00005     \brief class CForm (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "Form.h"
00010
00011 #ifdef _DEBUG
00012 #undef THIS_FILE
00013 static char THIS_FILE[]=__FILE__;
00014 #define new DEBUG_NEW
00015 #endif
00016
00017
00018 namespace Model
00019 {
00020
00021 /*!
00022     Constructs a new unproved and unsigned form
00023 */
00024 CForm::CForm()
00025 {
00026     m_bProved = m_bSigned = false;
00027 }
00028
00029
00030 /*!
00031     Copies an existing CForm
00032     \param form form to be copied
00033     \see operator=
00034 */
00035 CForm::CForm(const CForm& form)
00036 {
00037     operator=(form);
00038 }
00039
00040
00041 /*!
00042     Constructs a new form using given attributes
00043     \param strAuthor    author
00044     \param strTitle     title
00045     \param strKey       key
00046     \param bProved      is it proved ?
00047     \param bSigned      is it signed ?
00048     \param strFormality formality
00049 */
00050 CForm::CForm(CString strAuthor, CString strTitle, CString strKey,
00051              bool    bProved,   bool    bSigned,  CString strFormality)
00052      : CBankDocument(strAuthor, strTitle, strKey)
00053 {
00054     m_bProved = bProved;
00055     m_bSigned = bSigned;
00056
00057     m_strFormality = strFormality;
00058     HasChanged();
00059 }
00060
00061
00062 /*!
00063     No clean-up required
00064 */
00065 CForm::~CForm()
00066 {
00067 }
00068
00069
00070 /*!
00071     Create a new non-initialized object
00072     \return new instance of CForm
00073 */
00074 CObject* CForm::Generate () const
00075 {
00076     return new CForm;
00077 }
00078
00079
00080 /*!
00081     Clone this object
00082     \return exact copy
00083 */
00084 CObject* CForm::GenerateC() const
00085 {
00086     return new CForm(*this);
00087 }
00088
00089
00090 /*!
00091     Loads/stores CForm
00092     \param ar CArchive that provides data persistency
00093 */
00094 void CForm::Serialize(CArchive &ar)
00095 {
00096     // serialize parent
00097     CBankDocument::Serialize(ar);
00098
00099     // CArchive can't handle "bool" so I have to use "BOOL" (which is "int" ...)
00100     BOOL bProved = m_bProved,
00101          bSigned = m_bSigned;
00102
00103     if (ar.IsStoring())
00104         ar << bProved << bSigned << m_strFormality;
00105     else
00106         ar >> bProved >> bSigned >> m_strFormality;
00107
00108     // neccessary because of MFC's "bool!=BOOL story"
00109     m_bProved = (bProved == TRUE);
00110     m_bSigned = (bSigned == TRUE);
00111
00112     // << and >> operators are not overloaded
00113     m_dtAlterationDate.Serialize(ar);
00114 }
00115
00116
00117 /*!
00118     Determines whether the form is valid,
00119     \b invariant describes further details (see above)
00120 */
00121 void CForm::AssertValid() const
00122 {
00123     CBankDocument::AssertValid();
00124
00125     ASSERT(!m_strFormality.IsEmpty());
00126     ASSERT_VALID(&m_dtAlterationDate);
00127 }
00128
00129
00130 /*!
00131     Create a dump of the class (only DEBUG version)
00132     \param dc output dump stream
00133 */
00134 void CForm::Dump(CDumpContext& dc) const
00135 {
00136     CBankDocument::Dump(dc);
00137
00138     dc << "\n"
00139        << "proved: " << m_bProved << "\n"
00140        << "signed: " << m_bSigned << "\n"
00141        << "formality: " << m_strFormality << "\n"
00142        << "alternation date: ";
00143
00144     m_dtAlterationDate.Dump(dc);
00145 }
00146
00147
00148 /*!
00149     Copies all attributes for polymorphic behaviour
00150     \param  form CForm that should be copied
00151     \return reference to the copied form
00152 */
00153 CForm& CForm::operator = (const CForm& form)
00154 {
00155     // copy inherited attributes
00156     CBankDocument::operator =(form);
00157
00158     // copy CForm's attributes
00159     m_bProved = form.m_bProved;
00160     m_bSigned = form.m_bSigned;
00161     m_dtAlterationDate = form.m_dtAlterationDate;
00162     m_strFormality     = form.m_strFormality;
00163
00164     return *this;
00165 }
00166
00167
00168 /*!
00169     Copies all attributes for polymorphic behaviour
00170     \param  bankdocument CForm (casted as CBankDocument) that should be copied
00171     \return reference to the copied form
00172 */
00173 CBankDocument& CForm::operator = (const CBankDocument& bankdocument)
00174 {
00175     try
00176     {
00177         // copy all attributes
00178         operator =(dynamic_cast<const CForm&>(bankdocument));
00179     }
00180     catch(...)
00181     {
00182         // invalid class
00183 #ifdef _DEBUG
00184         TRACE("Copy denied because of invalid cast (needed a CForm)\n");
00185         Dump(afxDump);
00186         bankdocument.Dump(afxDump);
00187 #endif
00188     }
00189
00190     return *this;
00191 }
00192
00193
00194 /*!
00195     Compare attributes (except key) of two forms
00196     \param  form CForm that we compare to
00197     \return true, if all attributes are equal
00198 */
00199 bool CForm::operator ==(const CForm& form) const
00200 {
00201     return (CBankDocument::operator ==(form) &&
00202             m_bProved == form.m_bProved &&
00203             m_bSigned == form.m_bSigned &&
00204 //            m_dtAlterationDate == form.m_dtAlterationDate &&
00205             m_strFormality     == form.m_strFormality);
00206 }
00207
00208
00209 /*!
00210     Compares all attributes for polymorphic behaviour
00211     \param  bankdocument CForm (casted as CBankDocument) that should be compared to
00212     \return true, if all attributes are equal
00213 */
00214 bool CForm::operator ==(const CBankDocument& bankdocument) const
00215 {
00216     try
00217     {
00218         // compare all attributes
00219         return operator ==(dynamic_cast<const CForm&>(bankdocument));
00220     }
00221     catch(...)
00222     {
00223         // invalid class
00224         TRACE("Comparison denied because of invalid cast\n"
00225               "(needed a CForm and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00226 #ifdef _DEBUG
00227         Dump(afxDump);
00228         bankdocument.Dump(afxDump);
00229 #endif
00230     }
00231
00232     return false;
00233 }
00234
00235
00236 /*!
00237     Responsible for the generation of a unique key based on the object's attributes
00238     \return CString that contains the key
00239 */
00240 CString CForm::KeyOf() const
00241 {
00242     CString strKey;
00243     strKey.Format("[%s|%d|%d|%s|%s|%p]", m_strFormality, m_bProved,  m_bSigned,
00244                                          m_dtAlterationDate.KeyOf(),
00245                                          CBankDocument::KeyOf(),
00246                                          this);
00247     return strKey;
00248 }
00249
00250
00251 /*!
00252     Get "proved" property
00253     \return true, if form is proved
00254 */
00255 bool CForm::GetProved() const
00256 {
00257     return m_bProved;
00258 }
00259 /*!
00260     Get "signed" property
00261     \return true, if form is signed
00262 */
00263 bool CForm::GetSigned() const
00264 {
00265     return m_bSigned;
00266 }
00267 /*!
00268     Get formality
00269     \return formality
00270 */
00271 CString CForm::GetFormality() const
00272 {
00273     return m_strFormality;
00274 }
00275 /*!
00276     Get alteration date
00277     \return alteration date
00278 */
00279 CMyDate CForm::GetAlterationDate() const
00280 {
00281     return m_dtAlterationDate;
00282 }
00283
00284
00285 /*!
00286     Set "proved" property
00287     \param bProved true, if form is proved
00288 */
00289 void CForm::SetProved(bool bProved)
00290 {
00291     m_bProved = bProved;
00292     // update alteration date
00293     HasChanged();
00294 }
00295 /*!
00296     Set "signed" property
00297     \param bSigned true, if form is signed
00298 */
00299 void CForm::SetSigned(bool bSigned)
00300 {
00301     m_bSigned = bSigned;
00302     // update alteration date
00303     HasChanged();
00304 }
00305
00306
00307 /*!
00308     Update date of alteration
00309 */
00310 void CForm::HasChanged()
00311 {
00312     m_dtAlterationDate = CMyDate();
00313 }
00314
00315
00316
00317 // serializable
00318 IMPLEMENT_SERIAL(CForm, CBankDocument, 1)
00319
00320 } // namespace Model


Form.h Source File

Form.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Form.h
00005     \brief class CForm (interface)
00006 */
00007
00008 #include "BankDocument.h"
00009 #pragma once
00010
00011 namespace Model
00012 {
00013
00014 //! A form
00015 /*!
00016     \author         Stephan Brumme
00017     \date           August 23, 2001
00018
00019     \invariant
00020     \li m_strFormality must be non-empty
00021     \li m_dtAlterationDate must be valid
00022     \li parent class must be valid
00023 */
00024
00025 //##ModelId=3B863AF702F8
00026 class CForm : public CBankDocument
00027 {
00028 public:
00029     //! default constructor
00030     //##ModelId=3B863AF703E0
00031     CForm();
00032     //! copy constructor
00033     //##ModelId=3B863AF703E1
00034     CForm(const CForm& form);
00035     //! explicitly set attributes
00036     //##ModelId=3B863AF703E3
00037     CForm(CString strAuthor, CString strTitle, CString strKey,
00038           bool    bProved,   bool    bSigned,  CString strFormality);
00039
00040     //! destructor
00041     //##ModelId=3B863AF703DE
00042     virtual ~CForm();
00043
00044     //! create a new object
00045     //##ModelId=3B863AF703DC
00046     virtual CObject* Generate () const;
00047     //! clone this object
00048     //##ModelId=3B863AF703DA
00049     virtual CObject* GenerateC() const;
00050     //! serialization
00051     //##ModelId=3B863AF703D7
00052     virtual void Serialize(CArchive &ar);
00053     //! validate the form
00054     //##ModelId=3B863AF703D5
00055     virtual void AssertValid() const;
00056     //! dump
00057     //##ModelId=3B863AF703B2
00058     virtual void Dump(CDumpContext& dc) const;
00059
00060     //! copy
00061     //##ModelId=3B863AF703AD
00062             CForm&         operator = (const CForm& form);
00063     //! polymorphic copy
00064     //##ModelId=3B863AF703AF
00065     virtual CBankDocument& operator = (const CBankDocument& bankdocument);
00066     //! comparison
00067     //##ModelId=3B863AF703A7
00068             bool operator ==(const CForm& form) const;
00069     //! polymorphic comparison
00070     //##ModelId=3B863AF703AA
00071     virtual bool operator ==(const CBankDocument& bankdocument) const;
00072
00073     //! deliver a unique identifier
00074     //##ModelId=3B863AF703A5
00075     virtual CString KeyOf() const;
00076
00077     //! determine whether form is proved
00078     //##ModelId=3B863AF703A3
00079     bool    GetProved()         const;
00080     //! determine whether form is signed
00081     //##ModelId=3B863AF70373
00082     bool    GetSigned()         const;
00083     //! get formality
00084     //##ModelId=3B863AF70371
00085     CString GetFormality()      const;
00086     //! get alteration date
00087     //##ModelId=3B863AF7036F
00088     CMyDate GetAlterationDate() const;
00089
00090     //! set "proved" property
00091     //##ModelId=3B863AF7036D
00092     void    SetProved(bool bProved);
00093     //! set "signed" property
00094     //##ModelId=3B863AF7036B
00095     void    SetSigned(bool bSigned);
00096
00097 protected:
00098     //! at least one attribute has changed
00099     //##ModelId=3B863AF7036A
00100     void HasChanged();
00101
00102 private:
00103     //! form is proved
00104     //##ModelId=3B88C0F20398
00105     bool    m_bProved;
00106     //! form is signed
00107     //##ModelId=3B88C0F20366
00108     bool    m_bSigned;
00109     //! formality
00110     //##ModelId=3B863AF70369
00111     CString m_strFormality;
00112     //! alteration date
00113     //##ModelId=3B863AF70366
00114     CMyDate m_dtAlterationDate;
00115
00116
00117     DECLARE_SERIAL(CForm)
00118 };
00119
00120 } // namespace Model


FormDialog.cpp Source File

FormDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  FormDialog.cpp
00005     \brief class CFormDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "FormDialog.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018
00019 namespace View
00020 {
00021
00022 /*!
00023     Initialize all dialog controls and get dialog mode (create or edit CForm)
00024     \param bInitialize true, if used to create a new CForm
00025     \param pParent handle of the parent window (not used)
00026 */
00027 CFormDialog::CFormDialog(bool bInitialize, CWnd* pParent /*=NULL*/)
00028     : CDialog(CFormDialog::IDD, pParent)
00029 {
00030     //{{AFX_DATA_INIT(CFormDialog)
00031     m_strAuthor = _T("");
00032     m_strDateOfFoundation = _T("");
00033     m_strKey = _T("");
00034     m_strTitle = _T("");
00035     m_strFormality = _T("");
00036     m_strAlterationDate = _T("");
00037     m_bProved = FALSE;
00038     m_bSigned = FALSE;
00039     //}}AFX_DATA_INIT
00040
00041     m_bInitialize = bInitialize;
00042     m_bModified   = false;
00043 }
00044
00045
00046 /*!
00047     Transfer data from the dialog controls to this class' member variables (and vice versa).
00048     Whole code is generated by wizards
00049     \param pDX data exchange object
00050     \see OnOK
00051 */
00052 void CFormDialog::DoDataExchange(CDataExchange* pDX)
00053 {
00054     CDialog::DoDataExchange(pDX);
00055     //{{AFX_DATA_MAP(CFormDialog)
00056     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00057     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00058     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00059     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00060     DDX_Text(pDX, IDC_EDIT_FORMALITY, m_strFormality);
00061     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00062     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00063     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00064     //}}AFX_DATA_MAP
00065 }
00066
00067
00068 /*!
00069     Enable/disable dialog controls to differ between creation and edit mode
00070     \see CFormDialog()
00071 */
00072 BOOL CFormDialog::OnInitDialog()
00073 {
00074     CDialog::OnInitDialog();
00075
00076     InitializeFlatSB      (GetDlgItem(IDC_EDIT_FORMALITY)->m_hWnd);
00077     FlatSB_EnableScrollBar(GetDlgItem(IDC_EDIT_FORMALITY)->m_hWnd, SB_VERT, 0);
00078
00079     // controls are only writeable if used for construction of a new object
00080     if (m_bInitialize)
00081     {
00082         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00083         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00084         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00085         ((CEdit*)GetDlgItem(IDC_EDIT_FORMALITY))->SetReadOnly(FALSE);
00086
00087         // set cursor to title edit control
00088         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00089
00090         // disallow MFC to change the focus we set
00091         return FALSE;
00092     }
00093
00094     // done, MFC may automatically set focus according to tab order
00095     return TRUE;
00096 }
00097
00098
00099 /*!
00100     Verify control's values and exit if all are valid
00101     \see DoDataExchange
00102 */
00103 void CFormDialog::OnOK()
00104 {
00105     // data exchange
00106     UpdateData();
00107
00108     // validate m_strTitle
00109     if (m_strTitle.IsEmpty())
00110     {
00111         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00112         return;
00113     }
00114
00115     // validate m_strAuthor
00116     if (m_strAuthor.IsEmpty())
00117     {
00118         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00119         return;
00120     }
00121
00122     // validate m_strKey
00123     if (m_strKey.IsEmpty())
00124     {
00125         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00126         return;
00127     }
00128
00129     // validate m_strFormality
00130     if (m_strFormality.IsEmpty())
00131     {
00132         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00133         return;
00134     }
00135
00136     // done
00137     if (m_bModified)
00138         CDialog::OnOK();
00139     else
00140         CDialog::OnCancel();
00141 }
00142
00143 void CFormDialog::OnChange()
00144 {
00145     m_bModified = true;
00146 }
00147
00148
00149 BEGIN_MESSAGE_MAP(CFormDialog, CDialog)
00150     //{{AFX_MSG_MAP(CFormDialog)
00151     ON_BN_CLICKED(IDC_CHECK_PROVED, OnChange)
00152     ON_BN_CLICKED(IDC_CHECK_SIGNED, OnChange)
00153     //}}AFX_MSG_MAP
00154 END_MESSAGE_MAP()
00155
00156 } // namespace View


FormDialog.h Source File

FormDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  FormDialog.h
00005     \brief class CFormDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog to create/edit CForm
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li each CString attribute must be non-empty
00019     \li invariant is verified by OnOK
00020 */
00021
00022 //##ModelId=3B863B030050
00023 class CFormDialog : public CDialog
00024 {
00025 public:
00026     //! constructor
00027     CFormDialog(bool bInitialize = false, CWnd* pParent = NULL);
00028
00029     //{{AFX_DATA(CFormDialog)
00030     //! ID of the used dialog resource
00031     enum { IDD = IDD_FORM };
00032     //! value of "author" edit control
00033     //##ModelId=3B863B03008A
00034     CString m_strAuthor;
00035     //! value of "date of foundation"  control
00036     //##ModelId=3B863B030089
00037     CString m_strDateOfFoundation;
00038     //! value of "key" edit control
00039     //##ModelId=3B863B030088
00040     CString m_strKey;
00041     //! value of "title" edit control
00042     //##ModelId=3B863B030087
00043     CString m_strTitle;
00044     //! value of "formality" edit control
00045     //##ModelId=3B863B030086
00046     CString m_strFormality;
00047     //! value of "alteration date" control
00048     //##ModelId=3B863B030085
00049     CString m_strAlterationDate;
00050     //! value of "proved" checkbox control
00051     //##ModelId=3B863B030084
00052     BOOL    m_bProved;
00053     //! value of "signed" checkbox control
00054     //##ModelId=3B863B030083
00055     BOOL    m_bSigned;
00056     //}}AFX_DATA
00057
00058
00059     //{{AFX_VIRTUAL(CFormDialog)
00060     protected:
00061     //! data exchange
00062     //##ModelId=3B863B0300BE
00063     virtual void DoDataExchange(CDataExchange* pDX);
00064     //}}AFX_VIRTUAL
00065
00066 protected:
00067
00068     //! true, if used to construct a new CForm (enable more controls)
00069     //##ModelId=3B863B030082
00070     bool m_bInitialize;
00071     //##ModelId=3B863B030052
00072     bool m_bModified;
00073     //##ModelId=3B863B03008F
00074     void OnChange();
00075
00076     //{{AFX_MSG(CFormDialog)
00077     //! initialize dialog controls
00078     //##ModelId=3B863B03008D
00079     virtual BOOL OnInitDialog();
00080     //! validate controls and close dialog
00081     //##ModelId=3B863B03008B
00082     virtual void OnOK();
00083     //}}AFX_MSG
00084     DECLARE_MESSAGE_MAP()
00085 };
00086
00087
00088 } // namespace View
00089 //{{AFX_INSERT_LOCATION}}


MainFrm.cpp Source File

MainFrm.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  MainFrm.cpp
00005     \brief class CMainFrame (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010
00011 #include "MainFrm.h"
00012
00013 #ifdef _DEBUG
00014 #define new DEBUG_NEW
00015 #undef THIS_FILE
00016 static char THIS_FILE[] = __FILE__;
00017 #endif
00018
00019 namespace Controller
00020 {
00021
00022 /*!
00023     Change visual appearance, remove file name from window title
00024     \param cs Windows style
00025     \return true, if successful
00026 */
00027 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
00028 {
00029     if( !CMDIFrameWnd::PreCreateWindow(cs) )
00030         return FALSE;
00031
00032     cs.style &= ~ FWS_ADDTOTITLE;
00033     cs.style |= FWS_PREFIXTITLE;
00034
00035     return TRUE;
00036 }
00037
00038
00039 IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
00040
00041 BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
00042     //{{AFX_MSG_MAP(CMainFrame)
00043     //}}AFX_MSG_MAP
00044 END_MESSAGE_MAP()
00045
00046 } // namespace Controller


MainFrm.h Source File

MainFrm.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  MainFrm.h
00005     \brief class CMainFrame (interface)
00006 */
00007
00008 #pragma once
00009
00010 //! Controller of the MVC concept
00011 /*!
00012     Coordinates data flow between user, Model and View
00013 */
00014 namespace Controller
00015 {
00016
00017 //! The MDI main frame
00018 /*! \author         Visual Studio Wizard
00019     \date           August 4, 2001
00020 */
00021
00022 //##ModelId=3B863AF8005A
00023 class CMainFrame : public CMDIFrameWnd
00024 {
00025 public:
00026     //! default constructor
00027     //##ModelId=3B863AF80096
00028     CMainFrame() {};
00029
00030     //{{AFX_VIRTUAL(CMainFrame)
00031     public:
00032     //##ModelId=3B863AF8005C
00033     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00034     //}}AFX_VIRTUAL
00035
00036 protected:
00037     //{{AFX_MSG(CMainFrame)
00038     //}}AFX_MSG
00039
00040     DECLARE_DYNAMIC(CMainFrame)
00041     DECLARE_MESSAGE_MAP()
00042 };
00043
00044
00045 } // namespace Controller
00046
00047 //{{AFX_INSERT_LOCATION}}


MyDate.cpp Source File

MyDate.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  MyDate.cpp
00005     \brief class CMyDate (implementation)
00006 */
00007
00008
00009 #include "stdafx.h"
00010 #include "MyDate.h"
00011 // we are using OS-specific date/time operations
00012 #include <time.h>
00013
00014 #ifdef _DEBUG
00015 #undef THIS_FILE
00016 static char THIS_FILE[]=__FILE__;
00017 #define new DEBUG_NEW
00018 #endif
00019
00020
00021 /*!
00022     Constructs a new object that contains current date and time
00023     \see GetCurrent
00024 */
00025 CMyDate::CMyDate()
00026 {
00027     GetCurrent(m_nDay, m_nMonth, m_nYear, m_nHour, m_nMinute, m_nSecond);
00028 }
00029
00030
00031 /*!
00032     Copies an existing CMyDate
00033     \param date date to be copied
00034     \see operator=
00035 */
00036 CMyDate::CMyDate(const CMyDate& date)
00037 {
00038     operator=(date);
00039 }
00040
00041
00042 /*!
00043     Constructs a new CMyDate using given date/time
00044     \param nDay    day
00045     \param nMonth  month
00046     \param nYear   year
00047     \param nHour   hour
00048     \param nMinute minute
00049     \param nSecond second
00050 */
00051 CMyDate::CMyDate(unsigned int nDay,  unsigned int nMonth,  unsigned int nYear,
00052                  unsigned int nHour, unsigned int nMinute, unsigned int nSecond)
00053 {
00054     // store date
00055     m_nDay    = nDay;
00056     m_nMonth  = nMonth;
00057     m_nYear   = nYear;
00058
00059     // store time
00060     m_nHour   = nHour;
00061     m_nMinute = nMinute;
00062     m_nSecond = nSecond;
00063 }
00064
00065
00066 /*!
00067     No deeper meaning right now
00068 */
00069 CMyDate::~CMyDate()
00070 {
00071 }
00072
00073
00074 /*!
00075     Loads/stores CMyDate
00076     \param ar CArchive that provides data persistency
00077 */
00078 void CMyDate::Serialize(CArchive &ar)
00079 {
00080     // do not forget to serialize CObject's data members
00081     CObject::Serialize(ar);
00082
00083     if (ar.IsStoring())
00084         ar << m_nYear << m_nMonth << m_nDay << m_nHour << m_nMinute << m_nSecond;
00085     else
00086         ar >> m_nYear >> m_nMonth >> m_nDay >> m_nHour >> m_nMinute >> m_nSecond;
00087 }
00088
00089
00090 /*!
00091     Determines whether the date is valid,
00092     \b invariant describes further details (see above)
00093 */
00094 void CMyDate::AssertValid() const
00095 {
00096     CObject::AssertValid();
00097
00098     // validate month
00099     ASSERT(m_nMonth >= JANUARY && m_nMonth <= DECEMBER);
00100
00101     // days per month, february may vary, note that array starts with 0 (JANUARY=1 !)
00102     unsigned int nDaysPerMonth[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
00103
00104     // adjust days of february
00105     if (IsLeapYear(m_nYear))
00106         nDaysPerMonth[FEBRUARY]++;
00107
00108     // validate day
00109     ASSERT(m_nDay > 0 && m_nDay <= nDaysPerMonth[m_nMonth]);
00110     // day and month are valid
00111
00112     // now check the time
00113     ASSERT(m_nHour   >= 0 && m_nHour   <= 23);
00114     ASSERT(m_nMinute >= 0 && m_nMinute <= 59);
00115     ASSERT(m_nSecond >= 0 && m_nSecond <= 59);
00116 }
00117
00118
00119 /*!
00120     Create a dump of the class (only DEBUG version)
00121     \param dc output dump stream
00122 */
00123 void CMyDate::Dump(CDumpContext& dc) const
00124 {
00125     CObject::Dump(dc);
00126
00127     CString strOutput;
00128     strOutput.Format("%02d.%02d.%04d - %02d:%02d:%02d",
00129                       m_nDay, m_nMonth, m_nYear, m_nHour, m_nMinute, m_nSecond);
00130     dc << strOutput;
00131 }
00132
00133
00134 /*!
00135     Static method that returns current date/time
00136 */
00137 void CMyDate::GetCurrent(unsigned int& nDay,  unsigned int& nMonth,  unsigned int& nYear,
00138                          unsigned int& nHour, unsigned int& nMinute, unsigned int& nSecond)
00139 {
00140     // the following code is basically taken from MSDN
00141
00142     // use system functions to get the current date as UTC
00143     time_t secondsSince1970;
00144     time(&secondsSince1970);
00145
00146     // convert UTC to local time zone
00147     struct tm *localTime;
00148     localTime = localtime(&secondsSince1970);
00149
00150     // store retrieved date
00151     nDay    = localTime->tm_mday;
00152     nMonth  = localTime->tm_mon + 1;
00153     nYear   = localTime->tm_year + 1900;
00154     // store time
00155     nHour   = localTime->tm_hour;
00156     nMinute = localTime->tm_min;
00157     nSecond = localTime->tm_sec;
00158 }
00159
00160
00161 /*!
00162     Static method to determine whether it is a leap year
00163     \param  nYear year to examine
00164     \return true, if nYear is a leap year
00165 */
00166 bool CMyDate::IsLeapYear(unsigned int nYear)
00167 {
00168     // used to speed up code, may be deleted
00169     if (nYear % 4   != 0)
00170         return false;
00171
00172     // algorithm taken from MSDN, just converted from VBA to C++
00173     if (nYear % 400 == 0)
00174         return true;
00175     if (nYear % 100 == 0)
00176         return false;
00177     if (nYear % 4   == 0)
00178         return true;
00179
00180     // this line won't be executed because of optimization (see above)
00181     return false;
00182 }
00183
00184
00185 /*!
00186     Copies all attributes
00187     \param  date CMyDate that should be copied
00188     \return reference to the copied date
00189     \see    CMyDate(const CMyDate& date)
00190     \see    Copy
00191     \see    operator=(const CTime& time)
00192 */
00193 CMyDate& CMyDate::operator =(const CMyDate& date)
00194 {
00195     // date
00196     m_nDay    = date.m_nDay;
00197     m_nMonth  = date.m_nMonth;
00198     m_nYear   = date.m_nYear;
00199     // time
00200     m_nHour   = date.m_nHour;
00201     m_nMinute = date.m_nMinute;
00202     m_nSecond = date.m_nSecond;
00203
00204     return *this;
00205 }
00206
00207
00208 /*!
00209     Copies date/time specific attributes of MFC's CTime
00210     \param  time CTime that should be copied
00211     \return reference to the copied date
00212     \see    CMyDate(const CMyDate& date)
00213     \see    operator=(const CMyDate& date)
00214 */
00215 CMyDate& CMyDate::operator =(const CTime& time)
00216 {
00217     // date
00218     m_nDay    = time.GetDay();
00219     m_nMonth  = time.GetMonth();
00220     m_nYear   = time.GetYear();
00221     // time
00222     m_nHour   = time.GetHour();
00223     m_nMinute = time.GetMinute();
00224     m_nSecond = time.GetSecond();
00225
00226     return *this;
00227 }
00228
00229
00230 /*!
00231     Compare attributes of two dates
00232     \param  date CMyDate that we compare to
00233     \return true, if all attributes are equal
00234 */
00235 bool CMyDate::operator ==(const CMyDate &date) const
00236 {
00237     // compare date and time attributes
00238     return (m_nDay    == date.m_nDay    &&
00239             m_nMonth  == date.m_nMonth  &&
00240             m_nYear   == date.m_nYear   &&
00241             m_nHour   == date.m_nHour   &&
00242             m_nMinute == date.m_nMinute &&
00243             m_nSecond == date.m_nSecond);
00244 }
00245
00246
00247 /*!
00248     Overloaded convertion operator for CTime
00249     \return CMyDate that is casted to CTime
00250 */
00251 CMyDate::operator CTime() const
00252 {
00253     return CTime(m_nYear, m_nMonth, m_nDay, m_nHour, m_nMinute, m_nSecond);
00254 }
00255
00256
00257 /*!
00258     Overloaded convertion operator for CString
00259     \return CMyDate that is casted to CString
00260     \see Format
00261 */
00262 CMyDate::operator CString() const
00263 {
00264     return Format("%A, %d.%B %Y, %H:%M:%S");
00265 }
00266
00267
00268 /*
00269     Formatted string representation similiar to printf
00270     \return a formatted string
00271 */
00272 CString CMyDate::Format(CString strFormat) const
00273 {
00274     return CTime(*this).Format(strFormat);
00275 }
00276
00277
00278 /*!
00279     Responsible for the generation of a unique key based on the object's attributes
00280     \return CString that contains the key
00281 */
00282 CString CMyDate::KeyOf() const
00283 {
00284     CString strKey;
00285     strKey.Format("[%d|%d|%d|%d|%d|%d|%p]", m_nDay,  m_nMonth,  m_nYear,
00286                                             m_nHour, m_nMinute, m_nSecond,
00287                                             this);
00288     return strKey;
00289 }
00290
00291
00292 /*!
00293     Set day
00294     \param nDay day
00295 */
00296 void CMyDate::SetDay(unsigned int nDay)
00297 {
00298     m_nDay = nDay;
00299 }
00300 /*!
00301     Set month
00302     \param nMonth month
00303 */
00304 void CMyDate::SetMonth(unsigned int nMonth)
00305 {
00306     m_nMonth = nMonth;
00307 }
00308 /*!
00309     Set year
00310     \param nYear year
00311 */
00312 void CMyDate::SetYear(unsigned int nYear)
00313 {
00314     m_nYear = nYear;
00315 }
00316 /*!
00317     Set hour
00318     \param nHour hour
00319 */
00320 void CMyDate::SetHour(unsigned int nHour)
00321 {
00322     m_nHour = nHour;
00323 }
00324 /*!
00325     Set minute
00326     \param nMinute minute
00327 */
00328 void CMyDate::SetMinute(unsigned int nMinute)
00329 {
00330     m_nMinute = nMinute;
00331 }
00332 /*!
00333     Set second
00334     \param nSecond second
00335 */
00336 void CMyDate::SetSecond(unsigned int nSecond)
00337 {
00338     m_nSecond = nSecond;
00339 }
00340
00341 /*!
00342     Get day
00343     \return day
00344 */
00345 unsigned int CMyDate::GetDay() const
00346 {
00347     return m_nDay;
00348 }
00349 /*!
00350     Get month
00351     \return month
00352 */
00353 unsigned int CMyDate::GetMonth() const
00354 {
00355     return m_nMonth;
00356 }
00357 /*!
00358     Get year
00359     \return year
00360 */
00361 unsigned int CMyDate::GetYear() const
00362 {
00363     return m_nYear;
00364 }
00365 /*!
00366     Get hour
00367     \return hour
00368 */
00369 unsigned int CMyDate::GetHour() const
00370 {
00371     return m_nHour;
00372 }
00373 /*!
00374     Get minute
00375     \return minute
00376 */
00377 unsigned int CMyDate::GetMinute() const
00378 {
00379     return m_nMinute;
00380 }
00381 /*!
00382     Get second
00383     \return second
00384 */
00385 unsigned int CMyDate::GetSecond() const
00386 {
00387     return m_nSecond;
00388 }
00389
00390
00391
00392 // serializable
00393 IMPLEMENT_SERIAL(CMyDate, CObject, 1)


MyDate.h Source File

MyDate.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  MyDate.h
00005     \brief class CMyDate (interface)
00006 */
00007
00008 #pragma once
00009
00010
00011 //! Stores date and time
00012 /*!
00013     \li 24h-based, no AM/PM support
00014     \li interface inspired by MFC's CTime
00015     \li conversion operator for CTime overloaded
00016
00017     \author         Stephan Brumme
00018     \date           August 5, 2001
00019
00020     \invariant
00021     \li restricted to the usual Gregorian calender (recognizes leap years)
00022 */
00023
00024 //##ModelId=3B863AFA000A
00025 class CMyDate : public CObject
00026 {
00027 public:
00028     //! default constructor
00029     //##ModelId=3B863AFA00EA
00030     CMyDate();
00031     //! copy constructor
00032     //##ModelId=3B863AFA00EB
00033     CMyDate(const CMyDate& date);
00034     //! set user defined date at construction time
00035     //##ModelId=3B863AFA00ED
00036     CMyDate(unsigned int nDay,    unsigned int nMonth,    unsigned int nYear,
00037             unsigned int nHour=0, unsigned int nMinute=0, unsigned int nSecond=0);
00038
00039     //! destructor
00040     //##ModelId=3B863AFA00E8
00041     virtual ~CMyDate();
00042
00043     //! serialization
00044     //##ModelId=3B863AFA00E6
00045     void Serialize(CArchive &ar);
00046     //! validate
00047     //##ModelId=3B863AFA00C9
00048     virtual void AssertValid() const;
00049     //! dump
00050     //##ModelId=3B863AFA00C6
00051     virtual void Dump(CDumpContext& dc) const;
00052
00053     //! return current date and time
00054     //##ModelId=3B863AFA00BE
00055     static void GetCurrent(unsigned int& nDay,  unsigned int& nMonth,  unsigned int& nYear,
00056                            unsigned int& nHour, unsigned int& nMinute, unsigned int& nSecond);
00057     //! true, if it is a leap year
00058     //##ModelId=3B863AFA00BB
00059     static bool IsLeapYear(unsigned int nYear);
00060
00061     //! copy
00062     //##ModelId=3B863AFA00B5
00063     virtual CMyDate& operator = (const CMyDate& date);
00064     //! to enhance compatibility to CTime
00065     //##ModelId=3B863AFA00B8
00066     virtual CMyDate& operator = (const CTime& time);
00067     //! compare two dates
00068     //##ModelId=3B863AFA008A
00069     virtual bool     operator ==(const CMyDate& date) const;
00070
00071     //! convert to MFC's CTime
00072     //##ModelId=3B863AFA0088
00073     virtual operator CTime() const;
00074     //! formatted string representation
00075     //##ModelId=3B863AFA0086
00076     virtual operator CString() const;
00077     //! formatted string representation
00078     //##ModelId=3B863AFA0083
00079     virtual CString  Format(CString strFormat) const;
00080
00081     //! generate a key
00082     //##ModelId=3B863AFA0081
00083     virtual CString KeyOf() const;
00084
00085     //! set day
00086     //##ModelId=3B863AFA007F
00087     void SetDay   (unsigned int nDay);
00088     //! set month
00089     //##ModelId=3B863AFA007D
00090     void SetMonth (unsigned int nMonth);
00091     //! set year
00092     //##ModelId=3B863AFA007B
00093     void SetYear  (unsigned int nYear);
00094     //! set hour
00095     //##ModelId=3B863AFA0079
00096     void SetHour  (unsigned int nHour);
00097     //! set minute
00098     //##ModelId=3B863AFA0056
00099     void SetMinute(unsigned int nMinute);
00100     //! set second
00101     //##ModelId=3B863AFA0054
00102     void SetSecond(unsigned int nSecond);
00103
00104     //! return day
00105     //##ModelId=3B863AFA0052
00106     unsigned int GetDay   () const;
00107     //! return month
00108     //##ModelId=3B863AFA0050
00109     unsigned int GetMonth () const;
00110     //! return year
00111     //##ModelId=3B863AFA004E
00112     unsigned int GetYear  () const;
00113     //! return hour
00114     //##ModelId=3B863AFA004C
00115     unsigned int GetHour  () const;
00116     //! return minute
00117     //##ModelId=3B863AFA004A
00118     unsigned int GetMinute() const;
00119     //! return second
00120     //##ModelId=3B863AFA0048
00121     unsigned int GetSecond() const;
00122
00123     //! constants for month's names
00124     /*! The constants were defined for better readability and aren't urgently required
00125     */
00126     enum { JANUARY   =  1, FEBRUARY =  2, MARCH    =  3, APRIL    =  4,
00127            MAY       =  5, JUNE     =  6, JULY     =  7, AUGUST   =  8,
00128            SEPTEMBER =  9, OCTOBER  = 10, NOVEMBER = 11, DECEMBER = 12 };
00129
00130 private:
00131     //! day
00132     //##ModelId=3B863AFA0047
00133     unsigned int m_nDay;
00134     //! month
00135     //##ModelId=3B863AFA0046
00136     unsigned int m_nMonth;
00137     //! year
00138     //##ModelId=3B863AFA000F
00139     unsigned int m_nYear;
00140
00141     //! hour
00142     //##ModelId=3B863AFA000E
00143     unsigned int m_nHour;
00144     //! minute
00145     //##ModelId=3B863AFA000D
00146     unsigned int m_nMinute;
00147     //! second
00148     //##ModelId=3B863AFA000C
00149     unsigned int m_nSecond;
00150
00151
00152     DECLARE_SERIAL(CMyDate)
00153 };


PolymorphicSet.h Source File

PolymorphicSet.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PolymorphicSet.h
00005     \brief template CPolymorphicSet<C> (interface + implementation)
00006 */
00007
00008 #pragma once
00009 #include "stdafx.h"
00010 // MFC's CList template is used
00011 #include <afxtempl.h>
00012 // add CTrace
00013 #include "Trace.h"
00014
00015
00016 //! Namespace that contains all model classes
00017 /*!
00018     \li Model component of the MVC concept
00019 */
00020 namespace Model
00021 {
00022     using Debug::CTrace;
00023
00024 //! Template of a polymorphic set
00025 /*! \li The only parameter is the base class of all elements (at least CObject)
00026     \li All elements are copied by the interface methods
00027         to avoid unexpected behaviour (e.g. external deletion)
00028     \li fully serializable
00029
00030     \author         Stephan Brumme
00031     \date           August 23, 2001
00032
00033     \invariant
00034     \li If the set is empty then m_Cursor must be NULL else it must point to a element
00035     \li No element is allowed to appear more than once
00036 */
00037
00038
00039 //##ModelId=3B863AFA0154
00040 template<class C> class CPolymorphicSet : public CObject
00041 {
00042 public:
00043     //! default constructor
00044     CPolymorphicSet();
00045     //! copy constructor
00046     CPolymorphicSet(const CPolymorphicSet<C>& set);
00047
00048     //! destructor
00049     virtual ~CPolymorphicSet();
00050
00051     //! serialization
00052     virtual void Serialize(CArchive &ar);
00053     //! invariance
00054     virtual void AssertValid() const;
00055     //! dump
00056     virtual void Dump(CDumpContext& dc) const;
00057
00058     //! copy the whole set
00059     virtual CPolymorphicSet<C>& operator=(const CPolymorphicSet<C>& set);
00060     //! compare two sets
00061     //! value identity
00062     virtual bool operator==(const CPolymorphicSet<C>& set) const;
00063     //! object identity
00064             bool Equal     (const CPolymorphicSet<C>* set) const;
00065
00066     //! returns number of stored elements
00067     int Card() const;
00068
00069     //! first stored element
00070     C* GetFirst();
00071     //! next element
00072     C* GetNext();
00073     //! gets the element the cursor points to
00074     C* GetCurrent() const;
00075     //! set the cursor to the element specified by an index
00076     void SetCursor(int nIndex);
00077
00078     //! inserts an element
00079     int  Insert(const C* element);
00080     //! deletes current element
00081     void Scratch();
00082     //! deletes the whole set
00083     void ScratchAll();
00084
00085     //! finds an element
00086     bool Find(const C* element);
00087
00088 protected:
00089     //! creates a new instance and copies all attributes
00090     C* Clone(const C* element) const;
00091
00092     //! stores all elements in a list
00093     //##ModelId=3B863AFA0199
00094     CList<C*, C*> m_Set;
00095     //! cursor, may be altered at any time
00096     //##ModelId=3B863AFA0194
00097     POSITION m_Cursor;
00098 };
00099
00100
00101 ///////////////////////////////////////////////////////////
00102 ///////////////////////////////////////////////////////////
00103 ///////////////////////////////////////////////////////////
00104
00105
00106 /*!
00107     Constructs an empty set
00108 */
00109 template<class C> CPolymorphicSet<C>::CPolymorphicSet()
00110 {
00111     // empty set
00112     m_Cursor = NULL;
00113 }
00114
00115
00116 /*!
00117     Copies an existing set
00118     \param set reference to the set that should be copied
00119     \see operator=
00120 */
00121 template<class C> CPolymorphicSet<C>::CPolymorphicSet(const CPolymorphicSet<C>& set)
00122 {
00123     operator=(set);
00124 }
00125
00126
00127 /*!
00128     Cleans up memory
00129     \see ScratchAll
00130 */
00131 template<class C> CPolymorphicSet<C>::~CPolymorphicSet()
00132 {
00133     ScratchAll();
00134 }
00135
00136
00137 /*!
00138     Loads / stores the set
00139     \param ar CArchive that provides access to the file system
00140 */
00141 template<class C> void CPolymorphicSet<C>::Serialize(CArchive &ar)
00142 {
00143     CTrace trace("Serialize",this);
00144
00145     // do not forget to serialize CObject's data members
00146     CObject::Serialize(ar);
00147
00148     // make use of CArchive's overloaded << and >> operators for *CObject
00149
00150     if (ar.IsStoring())
00151     {
00152         // save polymorphic set
00153
00154         // write cardinality
00155         ar << m_Set.GetCount();
00156
00157         // write all elements
00158         POSITION pos     = m_Set.GetHeadPosition();
00159         int nCursorIndex = 0,
00160             nCount       = 0;
00161         while (pos != NULL)
00162         {
00163             // get cursor index
00164             if (m_Cursor == pos)
00165                 nCursorIndex = nCount;
00166             nCount++;
00167
00168             ar << m_Set.GetNext(pos);
00169         }
00170
00171         // store cursor index
00172         ar << nCursorIndex;
00173     }
00174     else
00175     {
00176         // load polymorphic set
00177
00178         // first, delete old set
00179         ScratchAll();
00180
00181         int nCount;
00182         // load cardinality
00183         ar >> nCount;
00184         // load all elements
00185         for (int i=0; i<nCount; i++)
00186         {
00187             C* element;
00188             ar >> element;
00189             m_Set.AddTail(element);
00190         }
00191
00192         // get cursor index
00193         int nCursorIndex;
00194         ar >> nCursorIndex;
00195         // create cursor out of the index
00196         m_Cursor = m_Set.FindIndex(nCursorIndex);
00197     }
00198 }
00199
00200
00201 /*!
00202     Determines whether the set is valid, \b invariant describes further details (see above)
00203 */
00204 template<class C> void CPolymorphicSet<C>::AssertValid() const
00205 {
00206     CObject::AssertValid();
00207
00208     // if the set is empty then cursor must be NULL
00209     if (m_Set.IsEmpty())
00210     {
00211         ASSERT(m_Cursor == NULL);
00212         return;
00213     }
00214
00215     CString strClassName = GetRuntimeClass()->m_lpszClassName;
00216
00217     // each element may be present in set at most once
00218     // cursor must point to an element (or NULL)
00219     POSITION pos = m_Set.GetHeadPosition();
00220     bool bValidCursor = false;
00221     if (m_Cursor == NULL)
00222         bValidCursor = true;
00223
00224     while (pos != NULL)
00225     {
00226         // element that the cursor points to was found ?
00227         if (pos == m_Cursor)
00228             bValidCursor = true;
00229
00230         // get element
00231         C* element = m_Set.GetNext(pos);
00232         POSITION posfind = pos;
00233         // compare to the remaining elements
00234         while (posfind != NULL)
00235         {
00236             C* compare = m_Set.GetNext(posfind);
00237             // no two equal elements are allowed
00238
00239             // same class ?
00240             if (strClassName == compare->GetRuntimeClass()->m_lpszClassName)
00241                 // equal values ?
00242                 ASSERT(!(*element == *compare));
00243         }
00244     }
00245
00246     // cursor successfully validated ?
00247     ASSERT(bValidCursor);
00248 }
00249
00250
00251 /*!
00252     Create a dump of the class (only DEBUG version)
00253     \param dc output dump stream
00254 */
00255 template<class C> void CPolymorphicSet<C>::Dump(CDumpContext& dc) const
00256 {
00257     CObject::Dump(dc);
00258
00259     // some general infos
00260     dc << Card() << " elements, cursor points to " << m_Cursor << "\n"
00261        << "// the following elements are separated by a line (----------)\n";
00262
00263     // dump all elements
00264     POSITION pos = m_Set.GetHeadPosition();
00265     while (pos != NULL)
00266     {
00267         m_Set.GetNext(pos)->Dump(dc);
00268         dc << "\n----------\n";
00269     }
00270 }
00271
00272
00273 /*!
00274     Copies all attributes with respect to cloning all elements and adjusting the cursor
00275     \param  set set that will be copied
00276     \return reference to the current set
00277     \see    CPolymorphicSet(const CPolymorphicSet<C>& set)
00278 */
00279 template<class C> CPolymorphicSet<C>& CPolymorphicSet<C>::operator=(const CPolymorphicSet<C>& set)
00280 {
00281     CTrace trace("operator=",this,&set);
00282
00283     // delete old elements
00284     ScratchAll();
00285
00286     POSITION pos = set.m_Set.GetHeadPosition();
00287     while (pos != NULL)
00288     {
00289         // save current position
00290         POSITION cursor = pos;
00291
00292         // clone each element
00293         C* element = set.m_Set.GetNext(pos);
00294         C* copy    = Clone(element);
00295         m_Set.AddTail(copy);
00296
00297         // set cursor
00298         // we can't use set.m_Cursor directly because we copied all elements
00299         // and therefore lost their old memory address
00300         if (cursor == set.m_Cursor)
00301             m_Cursor = m_Set.GetTailPosition();
00302     }
00303
00304     return *this;
00305 }
00306
00307
00308 /*!
00309     Compares all elements of two sets by value regardless their positions within the set.
00310     The cursors are not compared and may differ therefore
00311     \param  set set to compare to
00312     \return true, if both set are equal
00313     \pre    parameter "set" must be valid
00314 */
00315 template<class C> bool CPolymorphicSet<C>::operator==(const CPolymorphicSet<C>& set) const
00316 {
00317     CTrace trace("operator==",this,&set);
00318
00319     ASSERT_VALID(&set);
00320
00321     // same number of elements is required
00322     if (m_Set.GetCount() != set.m_Set.GetCount())
00323         return false;
00324
00325     // each element of this set must be found in the other set
00326     POSITION pos = m_Set.GetHeadPosition();
00327     while (pos != NULL)
00328     {
00329         C* element = m_Set.GetNext(pos);
00330         if (set.m_Set.Find(element))
00331             return false;
00332     }
00333
00334     // all elements were found, sets must be equal
00335     return true;
00336 }
00337
00338
00339 /*!
00340     Check whether two to sets are not only equal but also identical
00341     \param  set set to compare to
00342     \return true, if both sets are identical
00343 */
00344 template<class C> bool CPolymorphicSet<C>::Equal(const CPolymorphicSet<C>* set) const
00345 {
00346     CTrace trace("Equal",this,set);
00347
00348     return (set == this);
00349 }
00350
00351
00352 /*!
00353     Determine the size of the polymorphic set
00354     \return number of stored elements
00355 */
00356 template<class C> int CPolymorphicSet<C>::Card() const
00357 {
00358     CTrace trace("Card",this);
00359
00360     return m_Set.GetCount();
00361 }
00362
00363
00364 /*!
00365     Set cursor to the first element and return a copy of it
00366     \return copy of the first element
00367     \see    GetNext, GetCurrent
00368     \pre    set must be non-empty
00369 */
00370 template<class C> C* CPolymorphicSet<C>::GetFirst()
00371 {
00372     CTrace trace("GetFirst",this);
00373
00374     // set must not be empty
00375     ASSERT(!m_Set.IsEmpty());
00376
00377     // set cursor
00378     m_Cursor = m_Set.GetHeadPosition();
00379
00380     // generate copy
00381     C* copy = Clone(m_Set.GetHead());
00382     return copy;
00383 }
00384
00385
00386 /*!
00387     Iterate cursor to the next element and return a copy of it
00388     \return copy of the next element
00389     \see    GetFirst, GetCurrent
00390     \pre    set must be non-empty and cursor must be valid
00391 */
00392 template<class C> C* CPolymorphicSet<C>::GetNext()
00393 {
00394     CTrace trace("GetNext",this);
00395
00396     // set must not be empty
00397     ASSERT(!m_Set.IsEmpty());
00398     // cursor must not be at the end of the set
00399     ASSERT(m_Cursor != NULL);
00400
00401     // set cursor
00402     m_Set.GetNext(m_Cursor);
00403
00404     // generate copy
00405     C* copy = Clone(m_Set.GetAt(m_Cursor));
00406     return copy;
00407 }
00408
00409
00410 /*!
00411     Return a copy of the element the cursor points to
00412     \return copy of the current element
00413     \see    GetFirst, GetNext
00414     \pre    cursor must be valid
00415 */
00416 template<class C> C* CPolymorphicSet<C>::GetCurrent() const
00417 {
00418     CTrace trace("GetCurrent",this);
00419
00420     // cursor must not be at the end of the set
00421     ASSERT(m_Cursor != NULL);
00422
00423     // generate copy
00424     C* copy = Clone(m_Set.GetAt(m_Cursor));
00425     return copy;
00426 }
00427
00428
00429 /*!
00430     Set the cursor to an element specified by an index
00431     \param nIndex zero-based index
00432 */
00433 template<class C> void CPolymorphicSet<C>::SetCursor(int nIndex)
00434 {
00435     CTrace trace("SetCursor",this);
00436
00437     m_Cursor = m_Set.FindIndex(nIndex);
00438 }
00439
00440
00441 /*!
00442     Insert a new element into the set and return its position
00443     \param  element element to be inserted
00444     \return zero-based index, -1 if failed (element already exists)
00445     \see Clone
00446 */
00447 template<class C> int CPolymorphicSet<C>::Insert(const C* element)
00448 {
00449     CTrace trace("Insert",this,element);
00450
00451     // don't insert an object twice
00452     if (Find(element))
00453         return -1;
00454
00455     // add a copy to our set, change cursor
00456     m_Cursor = m_Set.AddTail(Clone(element));
00457
00458     // return index in the set
00459     return m_Set.GetCount()-1;
00460 }
00461
00462
00463 /*!
00464     Delete the element the cursor currently points to and adjust cursor
00465     \see ScratchAll
00466     \pre cursor must be valid (and the set non-empty)
00467 */
00468 template<class C> void CPolymorphicSet<C>::Scratch()
00469 {
00470     CTrace trace("Scratch",this);
00471
00472     // cursor must not be at the end of the set
00473     ASSERT(m_Cursor != NULL);
00474
00475     // store current cursor
00476     POSITION removepos = m_Cursor;
00477     // go on to the next element (else we lose it after erasing this element)
00478     m_Set.GetNext(m_Cursor);
00479
00480     // remove element that the cursor previously pointed to
00481     delete m_Set.GetAt(removepos);
00482     m_Set.RemoveAt(removepos);
00483 }
00484
00485
00486 /*!
00487     Delete the whole set including all stored elements
00488     \see Scratch
00489 */
00490 template<class C> void CPolymorphicSet<C>::ScratchAll()
00491 {
00492     CTrace trace("ScratchAll",this);
00493
00494     // front to back
00495     while (!m_Set.IsEmpty())
00496     {
00497         // delete element
00498         delete m_Set.GetHead();
00499         // remove the correspending pointer from the set
00500         m_Set.RemoveHead();
00501     }
00502
00503     // reset cursor
00504     m_Cursor = NULL;
00505 }
00506
00507
00508 /*!
00509     Search through the whole set and set m_Cursor if found
00510     \param  element element to look for
00511     \return true, if element was found
00512 */
00513 template<class C> bool CPolymorphicSet<C>::Find(const C* element)
00514 {
00515     CTrace trace("Find",this,element);
00516
00517     // only non-empty sets
00518     if (m_Set.IsEmpty())
00519         return false;
00520
00521     CString strClassName = element->GetRuntimeClass()->m_lpszClassName;
00522
00523     // iterate through the whole list
00524     POSITION pos = m_Set.GetHeadPosition();
00525     while (pos != NULL)
00526     {
00527         // store position in case we find a match
00528         POSITION storepos = pos;
00529
00530         // get an element we compare to
00531         C* compare  = m_Set.GetNext(pos);
00532
00533         // same class ?
00534         if (strClassName == compare->GetRuntimeClass()->m_lpszClassName)
00535             // equal values ?
00536             if (*element == *compare)
00537             {
00538                 // yes, set cursor and return "success !"
00539                 m_Cursor = storepos;
00540                 return true;
00541             }
00542     }
00543
00544     // element is not part of the set
00545     return false;
00546 }
00547
00548
00549 /*!
00550     Copy an object using MFC's own RTTI mechanismus to prevent polymorphism
00551     \param  element element to be cloned
00552     \return copy of element
00553 */
00554 template<class C> C* CPolymorphicSet<C>::Clone(const C* element) const
00555 {
00556     CTrace trace("Clone",this,element);
00557
00558     // create new instance (care for correct class !)
00559     C* copy = static_cast<C*>(element->GetRuntimeClass()->CreateObject());
00560     // copy attributes
00561     *copy = *element;
00562
00563     return copy;
00564 }
00565
00566 } // namespace Model


PraktikumMFC.cpp Source File

PraktikumMFC.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFC.cpp
00005     \brief class CPraktikumMFCApp (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010
00011 #include "MainFrm.h"
00012 #include "ChildFrm.h"
00013 #include "PraktikumMFCDoc.h"
00014 #include "PraktikumMFCView.h"
00015 #include "AboutDialog.h"
00016
00017 #ifdef _DEBUG
00018 #include "FileTrace.h"
00019 #include "DumpDialog.h"
00020 #endif
00021
00022 // use German translation for date conversion (month's name etc.)
00023 #include <locale.h>
00024
00025 #ifdef _DEBUG
00026 #define new DEBUG_NEW
00027 #undef THIS_FILE
00028 static char THIS_FILE[] = __FILE__;
00029 #endif
00030
00031
00032 namespace Application
00033 {
00034
00035 //! the one and only application object
00036 CPraktikumMFCApp theApp;
00037
00038 using Controller::CMainFrame;
00039 using Controller::CChildFrame;
00040 using Model::CPraktikumMFCDoc;
00041 using View::CPraktikumMFCView;
00042
00043
00044 CDumpDialog* CPraktikumMFCApp::m_pDumpDialog = NULL;
00045
00046
00047 CPraktikumMFCApp::CPraktikumMFCApp()
00048 {
00049 #ifdef _DEBUG
00050     Debug::Print = AddDebug;
00051     m_pDumpDialog = new CDumpDialog;
00052 #endif
00053 }
00054
00055
00056 CPraktikumMFCApp::~CPraktikumMFCApp()
00057 {
00058     if (m_pDumpDialog != NULL)
00059     {
00060         m_pDumpDialog->DestroyWindow();
00061         delete m_pDumpDialog;
00062     }
00063 }
00064
00065
00066 /*!
00067     Initialize application
00068     \return true, if successful
00069 */
00070 BOOL CPraktikumMFCApp::InitInstance()
00071 {
00072     // use German settings
00073     setlocale(LC_ALL, "German");
00074
00075 #ifdef _AFXDLL
00076     // shared MFC-DLL
00077     Enable3dControls();
00078 #else
00079     // statically linked MFC
00080     Enable3dControlsStatic();
00081 #endif
00082
00083     // registry key that stores the program's settings
00084     SetRegistryKey(_T("PraktikumMFC Stephan Brumme"));
00085
00086     // load program's settings
00087     LoadStdProfileSettings();
00088
00089     // register document templates
00090     CMultiDocTemplate* pDocTemplate;
00091     pDocTemplate = new CMultiDocTemplate(
00092         IDR_PRAKTITYPE,
00093         RUNTIME_CLASS(CPraktikumMFCDoc),
00094         RUNTIME_CLASS(CChildFrame),
00095         RUNTIME_CLASS(CPraktikumMFCView));
00096     AddDocTemplate(pDocTemplate);
00097
00098
00099     // build main MDI frame window
00100     CMainFrame* pMainFrame = new CMainFrame;
00101     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
00102         return FALSE;
00103     m_pMainWnd = pMainFrame;
00104
00105     // parse command line
00106     CCommandLineInfo cmdInfo;
00107     ParseCommandLine(cmdInfo);
00108
00109     // don't create a new file on start-up time
00110     if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
00111         cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
00112
00113     if (!ProcessShellCommand(cmdInfo))
00114         return FALSE;
00115
00116     // show debug window
00117     if (m_pDumpDialog)
00118     {
00119         m_pDumpDialog->Create(IDD_DEBUG);
00120         m_pDumpDialog->ShowWindow(SW_SHOW);
00121     }
00122
00123     // open new main window
00124     pMainFrame->ShowWindow(m_nCmdShow);
00125     pMainFrame->UpdateWindow();
00126
00127     // done
00128     return TRUE;
00129 }
00130
00131
00132 /*!
00133     Display some general info
00134     \see CAboutDialog
00135 */
00136 void CPraktikumMFCApp::OnAppAbout()
00137 {
00138     View::CAboutDialog dlg;
00139     dlg.DoModal();
00140 }
00141
00142
00143 /*!
00144     Start CHM help system using Windows shell
00145 */
00146 void CPraktikumMFCApp::OnHelp()
00147 {
00148     ShellExecute(NULL, "open", "PraktikumMFC.chm", NULL, NULL, SW_SHOWNORMAL);
00149 }
00150
00151
00152 /*!
00153     Open web browser (http://www.stephan-brumme.com) using Windows shell
00154 */
00155 void CPraktikumMFCApp::OnWWW()
00156 {
00157     ShellExecute(NULL, "open", "http://www.stephan-brumme.com/", NULL, NULL, SW_SHOWNORMAL);
00158 }
00159
00160
00161 /*!
00162     Show object dump
00163 */
00164 void CPraktikumMFCApp::OnShowDebug()
00165 {
00166 #ifdef _DEBUG
00167 #else
00168     AfxMessageBox("Debuginformationen nicht verfügbar.", MB_ICONSTOP);
00169 #endif
00170 }
00171
00172
00173 void CPraktikumMFCApp::AddDebug(const char* strText)
00174 {
00175 #ifdef _DEBUG
00176     if (IsDebug())
00177     {
00178         m_pDumpDialog->m_strDump += strText;
00179         m_pDumpDialog->m_strDump.Replace("\r\n", "\n");
00180         m_pDumpDialog->m_strDump.Replace("\n", "\r\n");
00181         m_pDumpDialog->UpdateData(FALSE);
00182     }
00183 #endif
00184 }
00185
00186
00187 bool CPraktikumMFCApp::IsDebug()
00188 {
00189     return (m_pDumpDialog != NULL);
00190 }
00191
00192
00193 BEGIN_MESSAGE_MAP(CPraktikumMFCApp, CWinApp)
00194     //{{AFX_MSG_MAP(CPraktikumMFCApp)
00195     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
00196     ON_COMMAND(ID_HELP, OnHelp)
00197     ON_COMMAND(ID_WWW, OnWWW)
00198     //}}AFX_MSG_MAP
00199     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
00200     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
00201 END_MESSAGE_MAP()
00202
00203 } // namespace Application;


PraktikumMFC.h Source File

PraktikumMFC.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFC.h
00005     \brief class CPraktikumMFCApp (interface)
00006 */
00007
00008 #pragma once
00009
00010 // compiler warning
00011 #ifndef __AFXWIN_H__
00012     #error include 'stdafx.h' before including this file for PCH
00013 #endif
00014
00015 // load resource symbols
00016 #include "resource.h"
00017
00018 #include "DumpDialog.h"
00019
00020 //! Application of the MVC concept
00021 /*!
00022     Combines Model, View and Controller
00023 */
00024 namespace Application
00025 {
00026     using Debug::CDumpDialog;
00027
00028 //! The main class
00029 /*! \li main class for the whole application
00030     \li to be used as a singleton
00031
00032     \author         Stephan Brumme
00033     \date           August 11, 2001
00034
00035     \invariant
00036     \li (none)
00037 */
00038
00039 //##ModelId=3B863B05010E
00040 class CPraktikumMFCApp : public CWinApp
00041 {
00042 public:
00043     //! default constructor
00044     /*! Nothing left to do \see InitInstance */
00045     //##ModelId=3B863B050186
00046     CPraktikumMFCApp();
00047
00048     //##ModelId=3B863B050185
00049     ~CPraktikumMFCApp();
00050     //{{AFX_VIRTUAL(CPraktikumMFCApp)
00051     public:
00052     //! initialize application (e.g. get settings)
00053     //##ModelId=3B863B050183
00054     virtual BOOL InitInstance();
00055     //}}AFX_VIRTUAL
00056
00057     //{{AFX_MSG(CPraktikumMFCApp)
00058     //! display some general info
00059     //##ModelId=3B863B050181
00060     afx_msg void OnAppAbout();
00061     //! start help system
00062     //##ModelId=3B863B05017F
00063     afx_msg void OnHelp();
00064     //! go to http://www.stephan-brumme.com/
00065     //##ModelId=3B863B05017D
00066     afx_msg void OnWWW();
00067     //! show debug dialog
00068     //##ModelId=3B863B050155
00069     afx_msg void OnShowDebug();
00070     //##ModelId=3B863B050152
00071     static void AddDebug(const char* strText);
00072     //! true, if debug dialog is visible
00073     //##ModelId=3B863B050150
00074     static bool IsDebug();
00075     //}}AFX_MSG
00076
00077 private:
00078     //##ModelId=3B863B05014D
00079     static CDumpDialog* m_pDumpDialog;
00080
00081     DECLARE_MESSAGE_MAP()
00082 };
00083
00084 } // namespace Application;
00085 //{{AFX_INSERT_LOCATION}}


PraktikumMFCDoc.cpp Source File

PraktikumMFCDoc.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFCDoc.cpp
00005     \brief class CPraktikumMFCDoc (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "PraktikumMFCDoc.h"
00011
00012 // used classes
00013 #include "MyDate.h"
00014 #include "Folder.h"
00015 #include "FolderDialog.h"
00016 #include "BankDocument.h"
00017 #include "BankDocumentDialog.h"
00018 #include "Form.h"
00019 #include "FormDialog.h"
00020 #include "StandingOrder.h"
00021 #include "StandingOrderDialog.h"
00022 #include "Contract.h"
00023 #include "ContractDialog.h"
00024
00025
00026 #ifdef _DEBUG
00027 #define new DEBUG_NEW
00028 #undef THIS_FILE
00029 static char THIS_FILE[] = __FILE__;
00030 #endif
00031
00032
00033 namespace Model
00034 {
00035
00036 /*!
00037     No debug dialog on startup
00038 */
00039 CPraktikumMFCDoc::CPraktikumMFCDoc()
00040 {
00041 }
00042
00043
00044 CPraktikumMFCDoc::~CPraktikumMFCDoc()
00045 {
00046 }
00047
00048
00049 /*!
00050     Ask for folder's properties
00051     \return true, if successful
00052     \see CFolderDialog
00053     \invariant see CFolderDialog
00054 */
00055 BOOL CPraktikumMFCDoc::OnNewDocument()
00056 {
00057     // the usual stuff
00058     if (!CDocument::OnNewDocument())
00059         return FALSE;
00060
00061     // ask for customer information
00062     View::CFolderDialog dlg(true);
00063     dlg.m_strDateOfFoundation = "(noch nicht angelegt)";
00064     if (dlg.DoModal() == IDOK)
00065     {
00066         // OK pressed, so create a new one
00067         CFolder myFolder(dlg.m_strCustomerInformation);
00068         m_Folder = myFolder;
00069         return TRUE;
00070     }
00071     else
00072         // cancel
00073         return FALSE;
00074 }
00075
00076
00077 /*!
00078     Load/store the document
00079     \param ar CArchive to be used
00080     \see CFolder::Serialize
00081 */
00082 void CPraktikumMFCDoc::Serialize(CArchive& ar)
00083 {
00084     m_Folder.Serialize(ar);
00085
00086     UpdateAllViews(NULL);
00087 }
00088
00089
00090 /*!
00091     Reset folder's set
00092 */
00093 void CPraktikumMFCDoc::DeleteContents()
00094 {
00095     // delete all elements in the set
00096     m_Folder.ScratchAll();
00097
00098     CDocument::DeleteContents();
00099     UpdateAllViews(NULL);
00100 }
00101
00102
00103 /*!
00104     Show folder's properties
00105     \see CFolderDialog
00106     \invariant see CFolderDialog
00107 */
00108 void CPraktikumMFCDoc::ShowCustomerinformation() const
00109 {
00110     View::CFolderDialog dlg;
00111     dlg.m_nCardinality = m_Folder.Card();
00112     dlg.m_strDateOfFoundation = m_Folder.GetDateOfFoundation().Format("%A, %d.%B, %Y, %H:%M:%S");
00113     dlg.m_strCustomerInformation = m_Folder.GetCustomerInformation();
00114
00115     dlg.DoModal();
00116 }
00117
00118
00119 /*!
00120     Insert a new bank document
00121     \see CBankDocument, CBankDocumentDialog
00122     \invariant see CBankDocumentDialog
00123 */
00124 void CPraktikumMFCDoc::InsertBankdocument()
00125 {
00126     // dialog is used for construction
00127     View::CBankDocumentDialog dlg(true);
00128
00129     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00130
00131     if (dlg.DoModal() == IDOK)
00132     {
00133         CBankDocument bankdocument(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey);
00134         m_Folder.Insert(&bankdocument);
00135     }
00136
00137     UpdateAllViews(NULL);
00138 }
00139
00140
00141 /*!
00142     Insert a new form
00143     \see CForm, CFormDialog
00144     \invariant see CFormDialog
00145 */
00146 void CPraktikumMFCDoc::InsertForm()
00147 {
00148     // dialog is used for construction
00149     View::CFormDialog dlg(true);
00150
00151     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00152     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00153     dlg.m_bProved = dlg.m_bSigned = FALSE;
00154
00155     if (dlg.DoModal() == IDOK)
00156     {
00157         // convert BOOL to bool
00158         bool bProved = (dlg.m_bProved != 0);
00159         bool bSigned = (dlg.m_bSigned != 0);
00160
00161         CForm form(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00162                    bProved, bSigned, dlg.m_strFormality);
00163         m_Folder.Insert(&form);
00164     }
00165
00166     UpdateAllViews(NULL);
00167 }
00168
00169
00170 /*!
00171     Insert a new standing order
00172     \see CStandingOrder, CStandingOrderDialog
00173     \invariant see CStandingOrderDialog
00174 */
00175 void CPraktikumMFCDoc::InsertStandingorder()
00176 {
00177     // dialog is used for construction
00178     View::CStandingOrderDialog dlg(true);
00179
00180     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00181     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00182     dlg.m_bProved = dlg.m_bSigned = FALSE;
00183     dlg.m_nAmount = dlg.m_nInterval = 0;
00184
00185     if (dlg.DoModal() == IDOK)
00186     {
00187         // convert BOOL to bool
00188         bool bProved = (dlg.m_bProved != 0);
00189         bool bSigned = (dlg.m_bSigned != 0);
00190
00191         CStandingOrder order(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00192                              bProved, bSigned, dlg.m_strFormality,
00193                              dlg.m_nAmount, dlg.m_strSubject, dlg.m_strSource,
00194                              dlg.m_strRecipient, dlg.m_nInterval);
00195         m_Folder.Insert(&order);
00196     }
00197
00198     UpdateAllViews(NULL);
00199 }
00200
00201
00202 /*!
00203     Insert a new contract
00204     \see CContract, CContractDialog
00205     \invariant see CContractDialog
00206 */
00207 void CPraktikumMFCDoc::InsertContract()
00208 {
00209     // dialog is used for construction
00210     View::CContractDialog dlg(true);
00211
00212     dlg.m_strDateOfFoundation = "(noch nicht erstellt)";
00213     dlg.m_strAlterationDate   = "(noch nicht erstellt)";
00214     dlg.m_bProved = dlg.m_bSigned = FALSE;
00215
00216     if (dlg.DoModal() == IDOK)
00217     {
00218         // convert BOOL to bool
00219         bool bProved = (dlg.m_bProved != 0);
00220         bool bSigned = (dlg.m_bSigned != 0);
00221
00222         CContract contract(dlg.m_strAuthor, dlg.m_strTitle, dlg.m_strKey,
00223                            dlg.m_nRegistrationNumber, bProved, bSigned, dlg.m_strWording);
00224         m_Folder.Insert(&contract);
00225     }
00226
00227     UpdateAllViews(NULL);
00228 }
00229
00230
00231 /*!
00232     Edit a folder's element, care for polymorphic behaviour of the set
00233     \param nEntry index of the edited element
00234     \see CBankDocument, CForm, CStandingOrder, CContract,
00235          CBankDocumentDialog, CFormDialog, CStandingOrderDialog, CContractDialog,
00236          CObject::IsKindOf
00237 */
00238 void CPraktikumMFCDoc::EditEntry(int nEntry)
00239 {
00240     // move cursor to the selected element
00241     m_Folder.SetCursor(nEntry);
00242     // get it
00243     CBankDocument* pObject = m_Folder.GetCurrent();
00244
00245     // IsKindOf is true, if class(a)=class(b) AND if class(a)=derived from class(b)
00246     // therefore, we have to look for derived classes first
00247
00248     // CContract ?
00249     if (pObject->IsKindOf(RUNTIME_CLASS(CContract)))
00250     {
00251         CContract* pContract = static_cast<CContract*>(pObject);
00252
00253         // fill in dialog's controls
00254         View::CContractDialog dlg;
00255         dlg.m_strDateOfFoundation = pContract->GetDateOfFoundation();
00256         dlg.m_strAlterationDate   = pContract->GetAlterationDate();
00257         dlg.m_strWording          = pContract->GetWording();
00258         dlg.m_nRegistrationNumber = pContract->GetRegistrationNumber();
00259         dlg.m_strAuthor = pContract->GetAuthor();
00260         dlg.m_strKey    = pContract->GetKey();
00261         dlg.m_strTitle  = pContract->GetTitle();
00262         dlg.m_bProved   = pContract->GetProved();
00263         dlg.m_bSigned   = pContract->GetSigned();
00264
00265         // only update if user pressed OK
00266         if (dlg.DoModal() == IDOK)
00267         {
00268             pContract->SetSigned(dlg.m_bProved != 0);
00269             pContract->SetProved(dlg.m_bSigned != 0);
00270             pContract->SetWording(dlg.m_strWording);
00271
00272             // delete old entry
00273             m_Folder.Scratch();
00274             // add the updated one
00275             m_Folder.Insert(pContract);
00276
00277             SetModifiedFlag();
00278         }
00279     }
00280     else
00281     // CStandingOrder ?
00282     if (pObject->IsKindOf(RUNTIME_CLASS(CStandingOrder)))
00283     {
00284         CStandingOrder* pOrder = static_cast<CStandingOrder*>(pObject);
00285
00286         // fill in dialog's controls
00287         View::CStandingOrderDialog dlg;
00288         dlg.m_strDateOfFoundation = pOrder->GetDateOfFoundation();
00289         dlg.m_strAlterationDate   = pOrder->GetAlterationDate();
00290         dlg.m_strFormality        = pOrder->GetFormality();
00291         dlg.m_strAuthor = pOrder->GetAuthor();
00292         dlg.m_strKey    = pOrder->GetKey();
00293         dlg.m_strTitle  = pOrder->GetTitle();
00294         dlg.m_bProved   = pOrder->GetProved();
00295         dlg.m_bSigned   = pOrder->GetSigned();
00296         dlg.m_nAmount   = pOrder->GetAmount();
00297         dlg.m_nInterval = pOrder->GetInterval();
00298         dlg.m_strSource = pOrder->GetSource();
00299         dlg.m_strRecipient = pOrder->GetRecipient();
00300         dlg.m_strSubject   = pOrder->GetSubject();
00301
00302         // only update if user pressed OK
00303         if (dlg.DoModal() == IDOK)
00304         {
00305             pOrder->SetSigned(dlg.m_bProved != 0);
00306             pOrder->SetProved(dlg.m_bSigned != 0);
00307             pOrder->SetAmount(dlg.m_nAmount);
00308             pOrder->SetInterval(dlg.m_nInterval);
00309
00310             // delete old entry
00311             m_Folder.Scratch();
00312             // add the updated one
00313             m_Folder.Insert(pOrder);
00314
00315             SetModifiedFlag();
00316         }
00317     }
00318     else
00319     // CForm ?
00320     if (pObject->IsKindOf(RUNTIME_CLASS(CForm)))
00321     {
00322         CForm* pForm = static_cast<CForm*>(pObject);
00323
00324         // fill in dialog's controls
00325         View::CFormDialog dlg;
00326         dlg.m_strDateOfFoundation = pForm->GetDateOfFoundation();
00327         dlg.m_strAlterationDate   = pForm->GetAlterationDate();
00328         dlg.m_strFormality        = pForm->GetFormality();
00329         dlg.m_strAuthor = pForm->GetAuthor();
00330         dlg.m_strKey    = pForm->GetKey();
00331         dlg.m_strTitle  = pForm->GetTitle();
00332         dlg.m_bProved   = pForm->GetProved();
00333         dlg.m_bSigned   = pForm->GetSigned();
00334
00335         // only update if user pressed OK
00336         if (dlg.DoModal() == IDOK)
00337         {
00338             pForm->SetSigned(dlg.m_bProved != 0);
00339             pForm->SetProved(dlg.m_bSigned != 0);
00340
00341             // delete old entry
00342             m_Folder.Scratch();
00343             // add the updated one
00344             m_Folder.Insert(pForm);
00345
00346             SetModifiedFlag();
00347         }
00348     }
00349     else
00350     // CBankDocument ?
00351     if (pObject->IsKindOf(RUNTIME_CLASS(CBankDocument)))
00352     {
00353         // fill in dialog's controls
00354         View::CBankDocumentDialog dlg;
00355         dlg.m_strAuthor = pObject->GetAuthor();
00356         dlg.m_strDateOfFoundation = pObject->GetDateOfFoundation();
00357         dlg.m_strKey    = pObject->GetKey();
00358         dlg.m_strTitle  = pObject->GetTitle();
00359
00360         // show dialog
00361         dlg.DoModal();
00362     }
00363     else
00364         // RTTI failed
00365         TRACE("Cannot identify class %s.\n", pObject->GetRuntimeClass()->m_lpszClassName);
00366
00367     // delete the copy
00368     delete pObject;
00369     UpdateAllViews(NULL);
00370 }
00371
00372
00373 /*!
00374     Delete the whole folder
00375 */
00376 void CPraktikumMFCDoc::DeleteAll()
00377 {
00378     m_Folder.ScratchAll();
00379     UpdateAllViews(NULL);
00380 }
00381
00382
00383 /*!
00384     Delete current element
00385     \param nEntry index of the selected element
00386 */
00387 void CPraktikumMFCDoc::DeleteEntry(int nEntry)
00388 {
00389     m_Folder.SetCursor(nEntry);
00390     m_Folder.Scratch();
00391     UpdateAllViews(NULL);
00392 }
00393
00394
00395 IMPLEMENT_DYNCREATE(CPraktikumMFCDoc, CDocument)
00396
00397 BEGIN_MESSAGE_MAP(CPraktikumMFCDoc, CDocument)
00398     //{{AFX_MSG_MAP(CPraktikumMFCDoc)
00399     //}}AFX_MSG_MAP
00400 END_MESSAGE_MAP()
00401
00402 } // namespace Model


PraktikumMFCDoc.h Source File

PraktikumMFCDoc.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFCDoc.h
00005     \brief class CPraktikumMFCDoc (interface)
00006 */
00007
00008 #pragma once
00009 #include "Folder.h"
00010 #include "DumpDialog.h"
00011
00012 namespace Model
00013 {
00014
00015 //! The main document
00016 /*! \li document of the application
00017
00018     \author         Stephan Brumme
00019     \date           August 23, 2001
00020
00021     \invariant
00022     \li (none)
00023 */
00024
00025 //##ModelId=3B863AFF0190
00026 class CPraktikumMFCDoc : public CDocument
00027 {
00028 protected:
00029     //! default constructor
00030     //##ModelId=3B863AFF0202
00031     CPraktikumMFCDoc();
00032     //! destructor
00033     //##ModelId=3B863AFF0201
00034     ~CPraktikumMFCDoc();
00035
00036 public:
00037     //! one and only data member
00038     //##ModelId=3B863AFF0194
00039     Model::CFolder m_Folder;
00040
00041     //{{AFX_VIRTUAL(CPraktikumMFCDoc)
00042     public:
00043     //! create a new document
00044     //##ModelId=3B863AFF01FF
00045     virtual BOOL OnNewDocument();
00046     //! serialize the folder
00047     //##ModelId=3B863AFF01CF
00048     virtual void Serialize(CArchive& ar);
00049     //! delete the folder's content
00050     //##ModelId=3B863AFF01CD
00051     virtual void DeleteContents();
00052     //}}AFX_VIRTUAL
00053
00054     //! edit a folder's element
00055     //##ModelId=3B863AFF01CB
00056     void EditEntry(int nEntry);
00057     //! insert a new bank document
00058     //##ModelId=3B863AFF01CA
00059     void InsertBankdocument();
00060     //! insert a new form
00061     //##ModelId=3B863AFF01C9
00062     void InsertForm();
00063     //! insert a new standing order
00064     //##ModelId=3B863AFF01C8
00065     void InsertStandingorder();
00066     //! insert a new contract
00067     //##ModelId=3B863AFF01C7
00068     void InsertContract();
00069     //! delete all elements
00070     //##ModelId=3B863AFF01C6
00071     void DeleteAll();
00072     //! delete a single element
00073     //##ModelId=3B863AFF01C4
00074     void DeleteEntry(int nEntry);
00075     //! show folder's properties
00076     //##ModelId=3B863AFF01C2
00077     void ShowCustomerinformation() const;
00078
00079 protected:
00080     //{{AFX_MSG(CPraktikumMFCDoc)
00081     //}}AFX_MSG
00082     DECLARE_DYNCREATE(CPraktikumMFCDoc)
00083     DECLARE_MESSAGE_MAP()
00084 };
00085
00086 } // namespace Model
00087
00088 //{{AFX_INSERT_LOCATION}}


PraktikumMFCView.cpp Source File

PraktikumMFCView.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFCView.cpp
00005     \brief class CPraktikumMFCView (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "PraktikumMFCDoc.h"
00011 #include "PraktikumMFCView.h"
00012
00013 // access CFolder
00014 #include "Folder.h"
00015 // folder's elements are derived from CBankDocument
00016 #include "BankDocument.h"
00017 #include "Form.h"
00018 #include "StandingOrder.h"
00019 #include "Contract.h"
00020
00021 #include "Scenario.h"
00022
00023 #ifdef _DEBUG
00024 #define new DEBUG_NEW
00025 #undef THIS_FILE
00026 static char THIS_FILE[] = __FILE__;
00027 #endif
00028
00029
00030 namespace View
00031 {
00032     using namespace Model;
00033
00034 /*!
00035     Set default window style (report that is maximized)
00036     \param cs current window style
00037     \return true, if successful
00038     \see OnCreate
00039 */
00040 BOOL CPraktikumMFCView::PreCreateWindow(CREATESTRUCT& cs)
00041 {
00042     if (!CListView::PreCreateWindow(cs))
00043         return FALSE;
00044
00045     // change style to a list view
00046     cs.style &= ~LVS_TYPEMASK;
00047     cs.style |= LVS_REPORT;
00048
00049     return TRUE;
00050 }
00051
00052
00053 /*!
00054     Set CListView's style and define columns
00055     \param lpCreateStruct passed to CWnd::OnCreate
00056     \return 0, if successful
00057     \see PreCreateWindow
00058 */
00059 int CPraktikumMFCView::OnCreate(LPCREATESTRUCT lpCreateStruct)
00060 {
00061     if (CListView::OnCreate(lpCreateStruct) == -1)
00062         return -1;
00063
00064     // get list control of our list view
00065     CListCtrl& list = GetListCtrl();
00066
00067     // set style
00068     list.ModifyStyle(0, LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER);
00069     list.SetExtendedStyle(list.GetExtendedStyle() |
00070                           LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES |
00071                           LVS_EX_FLATSB        | LVS_EX_TWOCLICKACTIVATE |
00072                           /*LVS_EX_LABELTIP*/ 0x00004000);
00073
00074     list.GetHeaderCtrl()->ModifyStyle(HDS_BUTTONS, 0);
00075
00076     // add needed columns
00077     list.InsertColumn(0, "Titel",   LVCFMT_LEFT, 150);
00078     list.InsertColumn(1, "Autor",   LVCFMT_LEFT, 100);
00079     list.InsertColumn(2, "Erstellt am",   LVCFMT_LEFT, 200);
00080     list.InsertColumn(3, "Geändert am",   LVCFMT_LEFT, 200);
00081     list.InsertColumn(4, "Typ",     LVCFMT_LEFT, 100);
00082
00083     return 0;
00084 }
00085
00086
00087 /*!
00088     Redraw view (CListView draws itself properly, see OnUpdate)
00089     \param pDC device context that needs to be redrawn
00090     \see OnUpdate
00091 */
00092 void CPraktikumMFCView::OnDraw(CDC* pDC)
00093 {
00094     CPraktikumMFCDoc* pDoc = GetDocument();
00095     ASSERT_VALID(pDoc);
00096 }
00097
00098
00099 /*!
00100     Update view because of changed document
00101     \param pSender message source (not used)
00102     \param lHint parameter (not used)
00103     \param pHint parameter (not used)
00104 */
00105 void CPraktikumMFCView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
00106 {
00107     // call parent class
00108     CListView::OnUpdate(pSender, lHint, pHint);
00109
00110     // get list control of our list view
00111     CListCtrl& list = GetListCtrl();
00112     // delete all entries
00113     list.DeleteAllItems();
00114
00115     // get folder
00116     CFolder* pFolder = &(GetDocument()->m_Folder);
00117     // determine size
00118     int nCount = pFolder->Card();
00119     // disable and exit if empty
00120     if (nCount == 0)
00121     {
00122         list.EnableWindow(FALSE);
00123         return;
00124     }
00125
00126     // enable window (white background instead of grey)
00127     list.EnableWindow(TRUE);
00128
00129     // prepare control that we insert some items
00130     list.SetItemCount(nCount);
00131
00132     // process all elements of the set
00133     for (int i=0; i<nCount; i++)
00134     {
00135         // get current element
00136         const CBankDocument* pBankDocument;
00137         if (i==0)
00138             pBankDocument = pFolder->GetFirst();
00139         else
00140             pBankDocument = pFolder->GetNext();
00141
00142         // show title
00143         list.InsertItem(i, pBankDocument->GetTitle());
00144         // show author
00145         list.SetItemText(i, 1, pBankDocument->GetAuthor());
00146         // show date of foundation
00147         CString a = pBankDocument->GetDateOfFoundation();
00148         list.SetItemText(i, 2, (CString)pBankDocument->GetDateOfFoundation());
00149
00150         // show type
00151         // first, determine class name
00152         CString strClassname = pBankDocument->GetRuntimeClass()->m_lpszClassName;
00153         if (strClassname == "CBankDocument")
00154             strClassname = "Bankdokument";
00155         else
00156             if (strClassname == "CForm")
00157             {
00158                 strClassname = "Formular";
00159                 list.SetItemText(i, 3,
00160                     (CString)((CForm*)pBankDocument)->GetAlterationDate());
00161             }
00162             else
00163                 if (strClassname == "CStandingOrder")
00164                 {
00165                     strClassname = "Dauerauftrag";
00166                     list.SetItemText(i, 3,
00167                         (CString)((CStandingOrder*)pBankDocument)->GetAlterationDate());
00168                 }
00169                 else
00170                     if (strClassname == "CContract")
00171                     {
00172                         strClassname = "Vertrag";
00173                         list.SetItemText(i, 3,
00174                             (CString)((CContract*)pBankDocument)->GetAlterationDate());
00175                     }
00176                     else
00177                         strClassname = "unbekannt ("+strClassname+")";
00178
00179         // actually show type
00180         list.SetItemText(i, 4, strClassname);
00181
00182         // delete copy fo the set's element
00183         delete pBankDocument;
00184     }
00185
00186 }
00187
00188
00189 /*!
00190     Called on double-clicks
00191     \param pNMHDR (not used)
00192     \param pResult (see return value)
00193     \return NULL if successful
00194     \see CPraktikumMFCDoc::EditEntry
00195 */
00196 void CPraktikumMFCView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
00197 {
00198     // code taken from Jeff Prosise's "MFC Programming" book, p. 545 (German edition)
00199
00200     // get mouse position
00201     DWORD dwPos = ::GetMessagePos();
00202     CPoint point ((int) LOWORD(dwPos), (int) HIWORD(dwPos));
00203     // convert from screen to window coordinates
00204     GetListCtrl().ScreenToClient(&point);
00205
00206     // determine correspending list entry
00207     int nIndex = GetListCtrl().HitTest(point);
00208
00209     // schnipp ! now my own code !
00210     if (nIndex != -1)
00211     {
00212         // edit list entry
00213         TRACE("%d clicked\n", nIndex);
00214         GetDocument()->EditEntry(nIndex);
00215     }
00216
00217     // okay, this very last line was written by Prosise, too
00218     *pResult = 0;
00219 }
00220
00221
00222 /*!
00223     Show current entry (called if user pressed "Return")
00224     \param pNMHDR (not used)
00225     \param pResult (see return value)
00226     \return NULL if successful
00227     \see OnShowCursor, OnDblclk
00228 */
00229 void CPraktikumMFCView::OnPressedReturn(NMHDR* pNMHDR, LRESULT* pResult)
00230 {
00231     OnShowCursor();
00232     *pResult = 0;
00233 }
00234
00235
00236 /*!
00237     Show current entry
00238     \see OnPressedReturn, OnDblclk
00239 */
00240 void CPraktikumMFCView::OnShowCursor()
00241 {
00242     // cursor position
00243     int nSelected = GetListCtrl().GetSelectionMark();
00244
00245     // only -1 if no document is selected
00246     if (nSelected != -1)
00247         GetDocument()->EditEntry(nSelected);
00248 }
00249
00250
00251 /*!
00252     Control menu entry that fires "OnShowCursor".
00253     Enable only if set is non-empty and list selection is valid
00254     \param pCmdUI menu entry
00255     \see OnShowCursor
00256 */
00257 void CPraktikumMFCView::OnUpdateShowCursor(CCmdUI* pCmdUI)
00258 {
00259     if (GetDocument()->m_Folder.Card() == 0 ||
00260         GetListCtrl().GetSelectionMark() == -1)
00261         pCmdUI->Enable(FALSE);
00262     else
00263         pCmdUI->Enable(TRUE);
00264 }
00265
00266
00267 /*!
00268     Delete the whole set
00269     \see OnUpdateDeleteAll, CPraktikumMFCDoc::DeleteAll
00270 */
00271 void CPraktikumMFCView::OnDeleteAll()
00272 {
00273     if (AfxMessageBox("Sind Sie sicher, dass Sie alle Dokumente löschen wollen ?",
00274                       MB_YESNO|MB_ICONQUESTION) == IDYES)
00275         GetDocument()->DeleteAll();
00276 }
00277
00278
00279 /*!
00280     Control menu entry that fires "OnDeleteAll".
00281     Enable only if set is non-empty
00282     \param pCmdUI menu entry
00283     \see OnDeleteAll
00284 */
00285 void CPraktikumMFCView::OnUpdateDeleteAll(CCmdUI* pCmdUI)
00286 {
00287     if (GetDocument()->m_Folder.Card() == 0)
00288         pCmdUI->Enable(FALSE);
00289     else
00290         pCmdUI->Enable(TRUE);
00291 }
00292
00293
00294 /*!
00295     Delete the current element
00296     \see OnUpdateDeleteCursor, CPraktikumMFCDoc::DeleteEntry
00297 */
00298 void CPraktikumMFCView::OnDeleteCursor()
00299 {
00300     int nSelected = GetListCtrl().GetSelectionMark();
00301
00302     if (nSelected != -1)
00303         if (AfxMessageBox("Sind Sie sicher, dass Sie das gewählte Dokument löschen wollen ?",
00304                           MB_YESNO|MB_ICONQUESTION) == IDYES)
00305             GetDocument()->DeleteEntry(nSelected);
00306 }
00307
00308
00309 /*!
00310     Control menu entry that fires "OnDeleteCursor".
00311     Enable only if list selection is valid
00312     \param pCmdUI menu entry
00313     \see OnDeleteCursor
00314 */
00315 void CPraktikumMFCView::OnUpdateDeleteCursor(CCmdUI* pCmdUI)
00316 {
00317     if (GetListCtrl().GetSelectionMark() == -1)
00318         pCmdUI->Enable(FALSE);
00319     else
00320         pCmdUI->Enable(TRUE);
00321 }
00322
00323
00324 /*!
00325     Show context menu on right mouse button click
00326     \param pWnd window that requests the context menu
00327     \param point mouse position
00328 */
00329 void CPraktikumMFCView::OnContextMenu(CWnd* pWnd, CPoint point)
00330 {
00331     // call parent class
00332     CWnd::OnContextMenu(pWnd, point);
00333
00334     // load menu
00335     CMenu menu;
00336     menu.LoadMenu(IDR_CONTEXTMENU);
00337
00338     // extract context menu
00339     CMenu* pContextMenu = menu.GetSubMenu(0);
00340     // show it
00341     pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
00342                                  point.x, point.y, AfxGetMainWnd());
00343 }
00344
00345
00346 /*!
00347     Insert a new bank document
00348     \see CPraktikumMFCDoc::InsertBankdocument
00349 */
00350 void CPraktikumMFCView::OnInsertBankdocument()
00351 {
00352     GetDocument()->InsertBankdocument();
00353 }
00354
00355 /*!
00356     Insert a new form
00357     \see CPraktikumMFCDoc::InsertForm
00358 */
00359 void CPraktikumMFCView::OnInsertForm()
00360 {
00361     GetDocument()->InsertForm();
00362 }
00363
00364 /*!
00365     Insert a new standing order
00366     \see CPraktikumMFCDoc::InsertStandingorder
00367 */
00368 void CPraktikumMFCView::OnInsertStandingorder()
00369 {
00370     GetDocument()->InsertStandingorder();
00371 }
00372
00373 /*!
00374     Insert a new contract
00375     \see CPraktikumMFCDoc::InsertContract
00376 */
00377 void CPraktikumMFCView::OnInsertContract()
00378 {
00379     GetDocument()->InsertContract();
00380 }
00381
00382 /*!
00383     Show the folder's properties
00384     \see CPraktikumMFCDoc::ShowCustomerinformation
00385 */
00386 void CPraktikumMFCView::OnShowCustomerinformation()
00387 {
00388     GetDocument()->ShowCustomerinformation();
00389 }
00390
00391
00392 /*!
00393     Create dump of the whole folder
00394     \see CPraktikumMFCDoc::ShowDebug
00395 */
00396 void CPraktikumMFCView::OnShowDebug()
00397 {
00398 #ifdef _DEBUG
00399     GetDocument()->m_Folder.Dump(afxDump);
00400 #endif
00401 }
00402
00403
00404 /*!
00405     Create dump of the currently selectly document
00406     \see OnShowDebug
00407 */
00408 void CPraktikumMFCView::OnShowDebugCurrent()
00409 {
00410 #ifdef _DEBUG
00411     GetDocument()->m_Folder.SetCursor(GetListCtrl().GetSelectionMark());
00412
00413     CBankDocument* bankdocument = GetDocument()->m_Folder.GetCurrent();
00414     bankdocument->Dump(afxDump);
00415     delete bankdocument;
00416 #endif
00417 }
00418
00419
00420 /*!
00421     Enable/disable menu entry for OnShowDebug
00422     \param pCmdUI menu entry that should be modified
00423     \see OnShowDebug
00424 */
00425 void CPraktikumMFCView::OnUpdateShowDebug(CCmdUI* pCmdUI)
00426 {
00427     pCmdUI->Enable(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug());
00428 }
00429
00430
00431 /*!
00432     Open debug dialog
00433     \see CPraktikumMFCApp::OnShowDebug
00434 */
00435 void CPraktikumMFCView::OnWindowDebug()
00436 {
00437     ((Application::CPraktikumMFCApp*)AfxGetApp())->OnShowDebug();
00438 }
00439
00440
00441 /*!
00442     Enable/disable menu entry for OnWindowDebug
00443     \param pCmdUI menu entry that should be modified
00444     \see OnWindowDebug
00445 */
00446 void CPraktikumMFCView::OnUpdateWindowDebug(CCmdUI* pCmdUI)
00447 {
00448     pCmdUI->SetCheck(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug());
00449 }
00450
00451
00452 /*!
00453     Run scenario Copy/EqualValue (document)
00454     \see Debug::CScenario::Copyequalvalue
00455 */
00456 void CPraktikumMFCView::OnScenarioCopyequalvalue()
00457 {
00458 #ifdef _DEBUG
00459     Debug::CScenario::Copyequalvalue(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00460 #endif
00461 }
00462
00463
00464 /*!
00465     Run scenario Find
00466     \see Debug::CScenario::Find
00467 */
00468 void CPraktikumMFCView::OnScenarioFind()
00469 {
00470 #ifdef _DEBUG
00471     Debug::CScenario::Find(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00472 #endif
00473 }
00474
00475
00476 /*!
00477     Run scenario EqualValue
00478     \see Debug::CScenario::EqualValue
00479 */
00480 void CPraktikumMFCView::OnScenarioEqualValue()
00481 {
00482 #ifdef _DEBUG
00483     Debug::CScenario::EqualValue(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00484 #endif
00485 }
00486
00487
00488 /*!
00489     Run scenario Insert
00490     \see Debug::CScenario::Insert
00491 */
00492 void CPraktikumMFCView::OnScenarioInsert()
00493 {
00494 #ifdef _DEBUG
00495     Debug::CScenario::Insert(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00496 #endif
00497 }
00498
00499
00500 /*!
00501     Run scenario Copy/EqualValue (CFolder)
00502     \see Debug::CScenario::CopyequalvalueFolder
00503 */
00504 void CPraktikumMFCView::OnScenarioCopyequalvalueFolder()
00505 {
00506 #ifdef _DEBUG
00507     Debug::CScenario::CopyequalvalueFolder(GetDocument()->m_Folder);
00508 #endif
00509 }
00510
00511
00512 /*!
00513     Run scenario Find/Scratch/Find
00514     \see Debug::CScenario::FindscratchfindFolder
00515 */
00516 void CPraktikumMFCView::OnScenarioFindscratchfindFolder()
00517 {
00518 #ifdef _DEBUG
00519     Debug::CScenario::FindscratchfindFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00520 #endif
00521 }
00522
00523
00524 /*!
00525     Run scenario Insert/Card
00526     \see Debug::CScenario::InsertcardFolder
00527 */
00528 void CPraktikumMFCView::OnScenarioInsertcardFolder()
00529 {
00530 #ifdef _DEBUG
00531     Debug::CScenario::InsertcardFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00532 #endif
00533 }
00534
00535
00536 /*!
00537     Run scenario Insert/Find/GetCurrent
00538     \see Debug::CScenario::InsertfindgetcurrentFolder
00539 */
00540 void CPraktikumMFCView::OnScenarioInsertfindgetcurrentFolder()
00541 {
00542 #ifdef _DEBUG
00543     Debug::CScenario::InsertfindgetcurrentFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00544 #endif
00545 }
00546
00547
00548 /*!
00549     Run scenario Scratch/Card
00550     \see Debug::CScenario::ScratchcardFolder
00551 */
00552 void CPraktikumMFCView::OnScenarioScratchcardFolder()
00553 {
00554 #ifdef _DEBUG
00555     Debug::CScenario::ScratchcardFolder(GetDocument()->m_Folder, GetListCtrl().GetSelectionMark());
00556 #endif
00557 }
00558
00559
00560 /*!
00561     Enable/disable menu entry for all scenarios
00562     \param pCmdUI menu entry that should be modified
00563     \see Debug::CScenario
00564 */
00565 void CPraktikumMFCView::OnUpdateScenario(CCmdUI* pCmdUI)
00566 {
00567 #ifndef _DEBUG
00568     pCmdUI->Enable(FALSE);
00569 #else
00570     pCmdUI->Enable(((Application::CPraktikumMFCApp*)AfxGetApp())->IsDebug() &&
00571                    GetListCtrl().GetSelectionMark() != -1);
00572 #endif
00573 }
00574
00575
00576
00577 BEGIN_MESSAGE_MAP(CPraktikumMFCView, CListView)
00578     //{{AFX_MSG_MAP(CPraktikumMFCView)
00579     ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
00580     ON_NOTIFY_REFLECT(NM_RETURN, OnPressedReturn)
00581     ON_COMMAND(ID_SHOW_CURSOR, OnShowCursor)
00582     ON_UPDATE_COMMAND_UI(ID_SHOW_CURSOR, OnUpdateShowCursor)
00583     ON_COMMAND(ID_DELETE_ALL, OnDeleteAll)
00584     ON_UPDATE_COMMAND_UI(ID_DELETE_ALL, OnUpdateDeleteAll)
00585     ON_COMMAND(ID_DELETE_CURSOR, OnDeleteCursor)
00586     ON_UPDATE_COMMAND_UI(ID_DELETE_CURSOR, OnUpdateDeleteCursor)
00587     ON_WM_CONTEXTMENU()
00588     ON_COMMAND(ID_SHOW_CUSTOMERINFORMATION, OnShowCustomerinformation)
00589     ON_COMMAND(ID_INSERT_BANKDOCUMENT, OnInsertBankdocument)
00590     ON_COMMAND(ID_INSERT_FORM, OnInsertForm)
00591     ON_COMMAND(ID_INSERT_STANDINGORDER, OnInsertStandingorder)
00592     ON_COMMAND(ID_INSERT_CONTRACT, OnInsertContract)
00593     ON_COMMAND(ID_SHOW_DEBUG, OnShowDebug)
00594     ON_UPDATE_COMMAND_UI(ID_SHOW_DEBUG, OnUpdateShowDebug)
00595     ON_UPDATE_COMMAND_UI(ID_SCENARIO_COPYEQUALVALUE, OnUpdateScenario)
00596     ON_COMMAND(ID_WINDOW_DEBUG, OnWindowDebug)
00597     ON_UPDATE_COMMAND_UI(ID_WINDOW_DEBUG, OnUpdateWindowDebug)
00598     ON_WM_CREATE()
00599     ON_COMMAND(ID_SCENARIO_COPYEQUALVALUE, OnScenarioCopyequalvalue)
00600     ON_COMMAND(ID_SCENARIO_FIND, OnScenarioFind)
00601     ON_COMMAND(ID_SCENARIO_EQUALVALUE, OnScenarioEqualValue)
00602     ON_COMMAND(ID_SCENARIO_INSERT, OnScenarioInsert)
00603     ON_COMMAND(ID_SHOW_DEBUG_CURRENT, OnShowDebugCurrent)
00604     ON_UPDATE_COMMAND_UI(ID_SCENARIO_FIND, OnUpdateScenario)
00605     ON_UPDATE_COMMAND_UI(ID_SCENARIO_EQUALVALUE, OnUpdateScenario)
00606     ON_UPDATE_COMMAND_UI(ID_SCENARIO_INSERT, OnUpdateScenario)
00607     ON_UPDATE_COMMAND_UI(ID_SHOW_DEBUG_CURRENT, OnUpdateScenario)
00608     ON_UPDATE_COMMAND_UI(ID_SCENARIO_COPYEQUALVALUE_FOLDER, OnUpdateShowDebug)
00609     ON_UPDATE_COMMAND_UI(ID_SCENARIO_FINDSCRATCHFIND_FOLDER, OnUpdateScenario)
00610     ON_UPDATE_COMMAND_UI(ID_SCENARIO_INSERTFINDGETCURRENT_FOLDER, OnUpdateShowDebug)
00611     ON_UPDATE_COMMAND_UI(ID_SCENARIO_INSERTCARD_FOLDER, OnUpdateShowDebug)
00612     ON_UPDATE_COMMAND_UI(ID_SCENARIO_SCRATCHCARD_FOLDER, OnUpdateScenario)
00613     ON_COMMAND(ID_SCENARIO_COPYEQUALVALUE_FOLDER, OnScenarioCopyequalvalueFolder)
00614     ON_COMMAND(ID_SCENARIO_FINDSCRATCHFIND_FOLDER, OnScenarioFindscratchfindFolder)
00615     ON_COMMAND(ID_SCENARIO_INSERTCARD_FOLDER, OnScenarioInsertcardFolder)
00616     ON_COMMAND(ID_SCENARIO_INSERTFINDGETCURRENT_FOLDER, OnScenarioInsertfindgetcurrentFolder)
00617     ON_COMMAND(ID_SCENARIO_SCRATCHCARD_FOLDER, OnScenarioScratchcardFolder)
00618     //}}AFX_MSG_MAP
00619 END_MESSAGE_MAP()
00620
00621
00622 IMPLEMENT_DYNCREATE(CPraktikumMFCView, CListView)
00623
00624 } // namespace View


PraktikumMFCView.h Source File

PraktikumMFCView.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  PraktikumMFCView.h
00005     \brief class CPraktikumMFCView (interface)
00006 */
00007
00008 #pragma once
00009
00010 //! View of the MVC concept
00011 /*!
00012     Displays all neccessary parts of the Model
00013 */
00014 namespace View
00015 {
00016
00017 //! The main view
00018 /*! \li view of the application
00019
00020     \author         Stephan Brumme
00021     \date           August 23, 2001
00022
00023     \invariant
00024     \li (none)
00025 */
00026
00027 //##ModelId=3B863AFE01CC
00028 class CPraktikumMFCView : public CListView
00029 {
00030 protected:
00031     //! default constructor
00032     /*! Nothing left to do */
00033     //##ModelId=3B863AFE02EA
00034     CPraktikumMFCView() {};
00035
00036 public:
00037     //! get attached document
00038     //##ModelId=3B863AFE02E9
00039     Model::CPraktikumMFCDoc* GetDocument();
00040
00041     //{{AFX_VIRTUAL(CPraktikumMFCView)
00042     public:
00043     //##ModelId=3B863AFE02E6
00044     virtual void OnDraw(CDC* pDC);
00045     //##ModelId=3B863AFE02BE
00046     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00047     protected:
00048     //##ModelId=3B863AFE02B9
00049     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
00050     //}}AFX_VIRTUAL
00051
00052 protected:
00053
00054     //{{AFX_MSG(CPraktikumMFCView)
00055     //##ModelId=3B863AFE02B5
00056     afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
00057     //##ModelId=3B863AFE02B1
00058     afx_msg void OnPressedReturn(NMHDR* pNMHDR, LRESULT* pResult);
00059     //##ModelId=3B863AFE02AF
00060     afx_msg void OnShowCursor();
00061     //##ModelId=3B863AFE02AC
00062     afx_msg void OnUpdateShowCursor(CCmdUI* pCmdUI);
00063     //##ModelId=3B863AFE02AA
00064     afx_msg void OnDeleteAll();
00065     //##ModelId=3B863AFE0289
00066     afx_msg void OnUpdateDeleteAll(CCmdUI* pCmdUI);
00067     //##ModelId=3B863AFE0287
00068     afx_msg void OnDeleteCursor();
00069     //##ModelId=3B863AFE0284
00070     afx_msg void OnUpdateDeleteCursor(CCmdUI* pCmdUI);
00071     //##ModelId=3B863AFE0280
00072     afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
00073     //##ModelId=3B863AFE027E
00074     afx_msg void OnShowCustomerinformation();
00075     //##ModelId=3B863AFE027C
00076     afx_msg void OnInsertBankdocument();
00077     //##ModelId=3B863AFE027A
00078     afx_msg void OnInsertForm();
00079     //##ModelId=3B863AFE0278
00080     afx_msg void OnInsertStandingorder();
00081     //##ModelId=3B863AFE0276
00082     afx_msg void OnInsertContract();
00083     //##ModelId=3B863AFE024C
00084     afx_msg void OnShowDebug();
00085     //##ModelId=3B863AFE0249
00086     afx_msg void OnUpdateShowDebug(CCmdUI* pCmdUI);
00087     //##ModelId=3B863AFE0246
00088     afx_msg void OnUpdateScenario(CCmdUI* pCmdUI);
00089     //##ModelId=3B863AFE0244
00090     afx_msg void OnWindowDebug();
00091     //##ModelId=3B863AFE0241
00092     afx_msg void OnUpdateWindowDebug(CCmdUI* pCmdUI);
00093     //##ModelId=3B863AFE023E
00094     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00095     //##ModelId=3B863AFE023C
00096     afx_msg void OnScenarioCopyequalvalue();
00097     //##ModelId=3B863AFE023A
00098     afx_msg void OnScenarioFind();
00099     //##ModelId=3B863AFE0217
00100     afx_msg void OnScenarioEqualValue();
00101     //##ModelId=3B863AFE0215
00102     afx_msg void OnScenarioInsert();
00103     //##ModelId=3B863AFE0213
00104     afx_msg void OnShowDebugCurrent();
00105     //##ModelId=3B863AFE0211
00106     afx_msg void OnScenarioCopyequalvalueFolder();
00107     //##ModelId=3B863AFE020F
00108     afx_msg void OnScenarioFindscratchfindFolder();
00109     //##ModelId=3B863AFE020D
00110     afx_msg void OnScenarioInsertcardFolder();
00111     //##ModelId=3B863AFE020B
00112     afx_msg void OnScenarioInsertfindgetcurrentFolder();
00113     //##ModelId=3B863AFE0209
00114     afx_msg void OnScenarioScratchcardFolder();
00115     //}}AFX_MSG
00116
00117     DECLARE_DYNCREATE(CPraktikumMFCView)
00118     DECLARE_MESSAGE_MAP()
00119 };
00120
00121 /*!
00122     Return the document that is attached to current view
00123     \return pointer to the document
00124 */
00125 inline Model::CPraktikumMFCDoc* CPraktikumMFCView::GetDocument()
00126 { return (Model::CPraktikumMFCDoc*)m_pDocument; }
00127
00128
00129 } // namespace View
00130 //{{AFX_INSERT_LOCATION}}


Scenario.cpp Source File

Scenario.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Scenario.cpp
00005     \brief class Debug::CScenario (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "Folder.h"
00010 #include "BankDocument.h"
00011 #include "Scenario.h"
00012
00013
00014 #ifdef _DEBUG
00015 #undef THIS_FILE
00016 static char THIS_FILE[]=__FILE__;
00017 #define new DEBUG_NEW
00018 #endif
00019
00020
00021
00022
00023 namespace Debug
00024 {
00025
00026 #ifdef _DEBUG
00027
00028     using Model::CBankDocument;
00029
00030 /*!
00031     \test  Case 1 of all documents: copy a document and compare copy/original document
00032     \attention always true !
00033     \param m_Folder used folder
00034     \param nEntry   used document
00035 */
00036 void CScenario::Copyequalvalue(CFolder& m_Folder, int nEntry)
00037 {
00038     if (AfxMessageBox("Dieses Szenario kopiert das gerade gewählte Dokument und\n"
00039                       "vergleicht anschließend Original und Kopie.\n\n"
00040                       "Der Test muss stets erfolgreich verlaufen.\n"
00041                       "Es werden keine Daten in der Originalkartei verändert.\n",
00042                       MB_OKCANCEL) == IDOK)
00043     {
00044         // move cursor to the selected element
00045         m_Folder.SetCursor(nEntry);
00046         // get it
00047         CBankDocument* pObject = m_Folder.GetCurrent();
00048         // generate copy
00049         CBankDocument* pObject2 = (CBankDocument*)pObject->Generate();
00050
00051         // copy
00052         TRACE("\nScenario Copy/EqualValue (document-based)\n");
00053         pObject->Dump(afxDump);
00054         TRACE("Now copying ...\n");
00055         *pObject2 = *pObject;
00056
00057         // compare
00058         TRACE("\n\nAnd comparing ...\n");
00059         ASSERT (*pObject == *pObject2);
00060         pObject2->Dump(afxDump);
00061
00062         // free allocated memory
00063         delete pObject;
00064         delete pObject2;
00065
00066         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00067     }
00068 }
00069
00070
00071 /*!
00072     \test Find an already existing document of the set
00073     \attention always true !
00074     \param m_Folder used folder
00075     \param nEntry   used document
00076 */
00077 void CScenario::Find(CFolder& m_Folder, int nEntry)
00078 {
00079     if (AfxMessageBox("Dieses Szenario sucht das gerade gewählte Dokument in der Kartei.\n\n"
00080                       "Der Test muss stets erfolgreich verlaufen.\n"
00081                       "Es werden keine Daten in der Originalkartei verändert.\n",
00082                       MB_OKCANCEL) == IDOK)
00083     {
00084         // move cursor to the selected element
00085         m_Folder.SetCursor(nEntry);
00086         // get it
00087         CBankDocument* pObject = m_Folder.GetCurrent();
00088
00089         TRACE("\nScenario Find\n");
00090         pObject->Dump(afxDump);
00091
00092         // find
00093         TRACE("Searching ...\n");
00094         ASSERT(m_Folder.Find(pObject));
00095
00096         // free allocated memory
00097         delete pObject;
00098
00099         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00100     }
00101 }
00102
00103
00104 /*!
00105     \test  Create a copy and slightly change date of foundation
00106     \attention always true, because date of foundation is not used for comparisons !
00107     \param m_Folder used folder
00108     \param nEntry   used document
00109 */
00110 void CScenario::EqualValue(CFolder& m_Folder, int nEntry)
00111 {
00112     if (AfxMessageBox("Dieses Szenario vergleicht das gerade gewählte Dokument\n"
00113                       "mit einer Kopie, bei der das Erzeugungsdatum verändert wurde.\n"
00114                       "Der Test muss stets erfolgreich verlaufen.\n"
00115                       "Es werden keine Daten in der Originalkartei verändert.\n",
00116                       MB_OKCANCEL) == IDOK)
00117     {
00118         // move cursor to the selected element
00119         m_Folder.SetCursor(nEntry);
00120         // get it (only used as CBankDocument)
00121         CBankDocument* pObject = m_Folder.GetCurrent();
00122
00123         // create a copy, modify date
00124         CBankDocument* pObject2 = new CBankDocument(pObject->GetAuthor(), pObject->GetTitle(),
00125                                                     pObject->GetKey());
00126
00127         TRACE("\nScenario Find\n");
00128         pObject->Dump(afxDump);
00129
00130         // compare (as CBankDocuments !!!)
00131         TRACE("Comparing ...\n");
00132         ASSERT(*pObject2 == *pObject);
00133
00134         // free allocated memory
00135         delete pObject2;
00136         delete pObject;
00137
00138         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00139     }
00140 }
00141
00142
00143 /*!
00144     \test  Insert an already document into the set
00145     \attention fails always !
00146     \param m_Folder used folder
00147     \param nEntry   used document
00148 */
00149 void CScenario::Insert(CFolder& m_Folder, int nEntry)
00150 {
00151     if (AfxMessageBox("Dieses Szenario versucht, das gerade gewählte Dokument\n"
00152                       "erneut in die Kartei einzufügen.\n\n"
00153                       "Der Test darf nicht erfolgreich verlaufen.\n"
00154                       "Es werden keine Daten in der Originalkartei verändert.\n",
00155                       MB_OKCANCEL) == IDOK)
00156     {
00157         // move cursor to the selected element
00158         m_Folder.SetCursor(nEntry);
00159         // get it
00160         CBankDocument* pObject = m_Folder.GetCurrent();
00161
00162         TRACE("\nScenario Find\n");
00163         pObject->Dump(afxDump);
00164
00165         // insert
00166         TRACE("Inserting ...\n");
00167         ASSERT(m_Folder.Insert(pObject) != -1);
00168
00169         // free allocated memory
00170         delete pObject;
00171
00172         TRACE("\nThis scenario was successfully completed if a window popped up !\n\n");
00173     }
00174 }
00175
00176
00177 /*!
00178     \test  Case 1 (CFolder): copy a folder and compare copy/original folder
00179     \attention always true !
00180     \param m_Folder used folder
00181 */
00182 void CScenario::CopyequalvalueFolder(CFolder& m_Folder)
00183 {
00184     if (AfxMessageBox("Dieses Szenario kopiert die aktuelle Kartei und\n"
00185                       "vergleicht anschließend Original und Kopie.\n\n"
00186                       "Der Test muss stets erfolgreich verlaufen.\n"
00187                       "Es werden keine Daten in der Originalkartei verändert.\n",
00188                       MB_OKCANCEL) == IDOK)
00189     {
00190         // create new folder
00191         CFolder* pFolder = new CFolder();
00192
00193         TRACE("\nScenario Copy/EqualValue (folder-based)\n");
00194         m_Folder.Dump(afxDump);
00195
00196         // copy
00197         TRACE("Now copying ...\n");
00198         *pFolder = m_Folder;
00199
00200         // compare
00201         TRACE("\n\nAnd comparing ...\n");
00202         ASSERT (m_Folder == *pFolder);
00203
00204         // free allocated memory
00205         delete pFolder;
00206
00207         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00208     }
00209 }
00210
00211
00212 /*!
00213     \test  Case 2 (CFolder): Insert a document into the set, find and retrieve it, compare it to the original
00214     \attention always true !
00215     \param m_Folder used folder
00216     \param nEntry   used document
00217 */
00218 void CScenario::InsertfindgetcurrentFolder(CFolder& m_Folder, int nEntry)
00219 {
00220     if (AfxMessageBox("Dieses Szenario fügt ein neues Bankdokument in die Kartei ein.\n"
00221                       "Anschließend wird danach gesucht, was den Cursor verändert.\n"
00222                       "Da es dann das aktuelle Element ist, wird es ausgelesen und muss mit dem Original übereinstimmen.\n\n"
00223                       "Der Test muss stets erfolgreich verlaufen.\n"
00224                       "Es werden keine Daten in der Originalkartei verändert.\n",
00225                       MB_OKCANCEL) == IDOK)
00226     {
00227         // new bankdocument
00228         CBankDocument bankdocument("Testautor_", "Testtitel_", "Testkey_");
00229         TRACE("\nScenario Insert/Find/GetCurrent\n");
00230         bankdocument.Dump(afxDump);
00231
00232         // copy folder (to avoid modifactions to the original one)
00233         CFolder* pFolder = new CFolder(m_Folder);
00234
00235         // insert
00236         TRACE("Inserting ...\n");
00237         ASSERT(pFolder->Insert(&bankdocument));
00238
00239         // find
00240         TRACE("Looking up ...\n");
00241         ASSERT(pFolder->Find(&bankdocument));
00242
00243         // get current
00244         TRACE("Getting current document ...\n");
00245         CBankDocument *pBankDocument = pFolder->GetCurrent();
00246
00247         // compare
00248         TRACE("Comparing ...\n");
00249         ASSERT(bankdocument == *pBankDocument);
00250
00251         // free allocated memory
00252         delete pBankDocument;
00253         delete pFolder;
00254
00255         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00256     }
00257 }
00258
00259
00260 /*!
00261     \test  Case 3 (CFolder): Find a document, scratch it and search for it again
00262     \attention fails always !
00263     \param m_Folder used folder
00264     \param nEntry   used document
00265 */
00266 void CScenario::FindscratchfindFolder(CFolder& m_Folder, int nEntry)
00267 {
00268     if (AfxMessageBox("Dieses Szenario sucht das gerade gewählte Dokument in der Kartei.\n"
00269                       "Anschließend wird es gelöscht und erneut danach gesucht.\n\n"
00270                       "Der Test darf nicht erfolgreich verlaufen.\n"
00271                       "Es werden keine Daten in der Originalkartei verändert.\n",
00272                       MB_OKCANCEL) == IDOK)
00273     {
00274         // move cursor to the selected element
00275         m_Folder.SetCursor(nEntry);
00276         // get it
00277         CBankDocument* pObject = m_Folder.GetCurrent();
00278
00279         TRACE("\nScenario Find/Scratch/Find\n");
00280         pObject->Dump(afxDump);
00281
00282         // copy folder (to avoid modifactions to the original one)
00283         CFolder* pFolder = new CFolder(m_Folder);
00284
00285         // find
00286         TRACE("Looking up document ...\n");
00287         ASSERT(pFolder->Find(pObject));
00288
00289         // scratch
00290         TRACE("Scratch it ...\n");
00291         pFolder->Scratch();
00292
00293         // find again
00294         TRACE("Looking up document for a second time ...\n");
00295         ASSERT(pFolder->Find(pObject));
00296
00297         // free allocated memory
00298         delete pObject;
00299         delete pFolder;
00300
00301         TRACE("\nThis scenario was successfully completed if a window popped up !\n\n");
00302     }
00303 }
00304
00305
00306 /*!
00307     \test  Case 4 (CFolder): Insert a new document - cardinality must increase by 1
00308     \attention always true !
00309     \param m_Folder used folder
00310     \param nEntry   used document
00311 */
00312 void CScenario::InsertcardFolder(CFolder& m_Folder, int nEntry)
00313 {
00314     if (AfxMessageBox("Dieses Szenario fügt ein neues Bankdokument in die Kartei ein.\n"
00315                       "Anschließend muss die Anzahl der Elemente um 1 größer sein.\n\n"
00316                       "Der Test muss stets erfolgreich verlaufen.\n"
00317                       "Es werden keine Daten in der Originalkartei verändert.\n",
00318                       MB_OKCANCEL) == IDOK)
00319     {
00320         // new bankdocument
00321         CBankDocument bankdocument("Testautor_", "Testtitel_", "Testkey_");
00322         TRACE("\nScenario Insert/Card\n");
00323         bankdocument.Dump(afxDump);
00324
00325         // copy folder (to avoid modifactions to the original one)
00326         CFolder* pFolder = new CFolder(m_Folder);
00327
00328         // cardinality
00329         int nOldCard = pFolder->Card();
00330         TRACE("Old Card: %d\n", nOldCard);
00331
00332         // insert
00333         TRACE("Inserting ...\n");
00334         ASSERT(pFolder->Insert(&bankdocument));
00335
00336         // cardinality for the second time
00337         int nNewCard = pFolder->Card();
00338         TRACE("New Card: %d\n", nNewCard);
00339
00340         // verify condition
00341         ASSERT(nOldCard+1==nNewCard);
00342
00343         // free allocated memory
00344         delete pFolder;
00345
00346         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00347     }
00348 }
00349
00350
00351 /*!
00352     \test  Case 5 (CFolder): Scratch current document - cardinality must decrease by 1
00353     \attention always true !
00354     \param m_Folder used folder
00355     \param nEntry   used document
00356 */
00357 void CScenario::ScratchcardFolder(CFolder& m_Folder, int nEntry)
00358 {
00359     if (AfxMessageBox("Dieses Szenario löscht das aktuell gewählte Dokument aus der Kartei.\n"
00360                       "Anschließend muss die Anzahl der Elemente um 1 niedriger sein.\n\n"
00361                       "Der Test muss stets erfolgreich verlaufen.\n"
00362                       "Es werden keine Daten in der Originalkartei verändert.\n",
00363                       MB_OKCANCEL) == IDOK)
00364     {
00365         // move cursor to the selected element
00366         m_Folder.SetCursor(nEntry);
00367         // get it
00368         CBankDocument* pObject = m_Folder.GetCurrent();
00369
00370         TRACE("\nScenario Scratch/Card\n");
00371
00372         // copy folder (to avoid modifactions to the original one)
00373         CFolder* pFolder = new CFolder(m_Folder);
00374
00375         // cardinality
00376         int nOldCard = pFolder->Card();
00377         TRACE("Old Card: %d\n", nOldCard);
00378
00379         // find
00380         TRACE("Looking up ...\n");
00381         ASSERT(pFolder->Find(pObject));
00382
00383         // scratch
00384         TRACE("Scratching ...\n");
00385         pFolder->Scratch();
00386
00387         // cardinality for the second time
00388         int nNewCard = pFolder->Card();
00389         TRACE("New Card: %d\n", nNewCard);
00390
00391         // verify condition
00392         ASSERT(nOldCard-1==nNewCard);
00393
00394         // free allocated memory
00395         delete pObject;
00396         delete pFolder;
00397
00398         TRACE("\nThis scenario was successfully completed if no window popped up !\n\n");
00399     }
00400 }
00401
00402 #endif
00403 } // namespace Debug
00404


Scenario.h Source File

Scenario.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Scenario.h
00005     \brief class Debug::CScenario (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace Debug
00011 {
00012
00013 #ifdef _DEBUG
00014     using Model::CFolder;
00015
00016 //! Generate scenarios
00017 /*! \li
00018
00019     \author         Stephan Brumme
00020     \date           August 23, 2001
00021
00022     \invariant
00023     \li (none)
00024 */
00025
00026 //##ModelId=3B863AF60071
00027 class CScenario
00028 {
00029 public:
00030     //! Copy/EqualValue (document, case 1)
00031     //##ModelId=3B863AF6011A
00032     static void Copyequalvalue(CFolder& m_Folder, int nEntry);
00033     //! Find a given document
00034     //##ModelId=3B863AF600F1
00035     static void Find(CFolder& m_Folder, int nEntry);
00036     //! Compare two slightly different documents
00037     //##ModelId=3B863AF600ED
00038     static void EqualValue(CFolder& m_Folder, int nEntry);
00039     //! Insert an already existing document
00040     //##ModelId=3B863AF600E9
00041     static void Insert(CFolder& m_Folder, int nEntry);
00042     //! Copy/EqualValue (folder, case 1)
00043     //##ModelId=3B863AF600E6
00044     static void CopyequalvalueFolder(CFolder& m_Folder);
00045     //! Insert/Find/GetCurrent (case 2);
00046     //##ModelId=3B863AF600E2
00047     static void InsertfindgetcurrentFolder(CFolder& m_Folder, int nEntry);
00048     //! Find/Scratch/Find (case 3)
00049     //##ModelId=3B863AF600DE
00050     static void FindscratchfindFolder(CFolder& m_Folder, int nEntry);
00051     //! Insert/Card (case 4)
00052     //##ModelId=3B863AF600AE
00053     static void InsertcardFolder(CFolder& m_Folder, int nEntry);
00054     //! Scratch/Card (case 5)
00055     //##ModelId=3B863AF600AA
00056     static void ScratchcardFolder(CFolder& m_Folder, int nEntry);
00057 };
00058
00059 #endif
00060 }


StandingOrder.cpp Source File

StandingOrder.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StandingOrder.cpp
00005     \brief class CStandingOrder (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "StandingOrder.h"
00010
00011 #ifdef _DEBUG
00012 #undef THIS_FILE
00013 static char THIS_FILE[]=__FILE__;
00014 #define new DEBUG_NEW
00015 #endif
00016
00017
00018 namespace Model
00019 {
00020
00021 /*!
00022     Constructs a new and empty standing order
00023 */
00024 CStandingOrder::CStandingOrder()
00025 {
00026     m_nAmount = m_nInterval = 0;
00027 }
00028
00029
00030 /*!
00031     Copies an existing CStandingOrder
00032     \param standingorder standing order to be copied
00033     \see operator=
00034 */
00035 CStandingOrder::CStandingOrder(const CStandingOrder& standingorder)
00036 {
00037     operator=(standingorder);
00038 }
00039
00040
00041 /*!
00042     Constructs a new standing order using given attributes
00043     \param strAuthor    author
00044     \param strTitle     title
00045     \param strKey       key
00046     \param bProved      is it proved ?
00047     \param bSigned      is it signed ?
00048     \param strFormality formality
00049     \param nAmount      amount to be paid
00050     \param nInterval    numbers of terms
00051     \param strSubject   subject
00052     \param strSource    source
00053     \param strRecipient recipient
00054 */
00055 CStandingOrder::CStandingOrder(CString strAuthor, CString strTitle, CString strKey,
00056                 bool    bProved,   bool    bSigned,  CString strFormality,
00057                 unsigned int nAmount, CString strSubject, CString strSource,
00058                 CString strRecipient, unsigned int nInterval)
00059               : CForm(strAuthor, strTitle, strKey, bProved, bSigned, strFormality)
00060 {
00061     m_nAmount      = nAmount;
00062     m_nInterval    = nInterval;
00063     m_strSubject   = strSubject;
00064     m_strSource    = strSource;
00065     m_strRecipient = strRecipient;
00066 }
00067
00068
00069 /*!
00070     No clean-up required
00071 */
00072 CStandingOrder::~CStandingOrder()
00073 {
00074 }
00075
00076
00077 /*!
00078     Create a new non-initialized object
00079     \return new instance of CStandingOrder
00080 */
00081 CObject* CStandingOrder::Generate() const
00082 {
00083     return new CStandingOrder;
00084 }
00085
00086
00087 /*!
00088     Clone this object
00089     \return exact copy
00090 */
00091 CObject* CStandingOrder::GenerateC() const
00092 {
00093     return new CStandingOrder(*this);
00094 }
00095
00096
00097 /*!
00098     Loads/stores CStandingOrder
00099     \param ar CArchive that provides data persistency
00100 */
00101 void CStandingOrder::Serialize(CArchive &ar)
00102 {
00103     // serialize parent
00104     CForm::Serialize(ar);
00105
00106     if (ar.IsStoring())
00107         ar << m_nAmount << m_nInterval << m_strSubject << m_strSource << m_strRecipient;
00108     else
00109         ar >> m_nAmount >> m_nInterval >> m_strSubject >> m_strSource >> m_strRecipient;
00110 }
00111
00112
00113 /*!
00114     Determines whether the standing order is valid,
00115     \b invariant describes further details (see above)
00116 */
00117 void CStandingOrder::AssertValid() const
00118 {
00119     CForm::AssertValid();
00120
00121     ASSERT(m_nAmount   > 0);
00122     ASSERT(m_nInterval > 0);
00123
00124     ASSERT(!m_strSubject.  IsEmpty());
00125     ASSERT(!m_strSource.   IsEmpty());
00126     ASSERT(!m_strRecipient.IsEmpty());
00127 }
00128
00129
00130 /*!
00131     Create a dump of the class (only DEBUG version)
00132     \param dc output dump stream
00133 */
00134 void CStandingOrder::Dump(CDumpContext& dc) const
00135 {
00136     CForm::Dump(dc);
00137
00138     CString strOutput;
00139     strOutput.Format("\namount: %d\ninterval: %d\nsubject: %s\nsource: %s\nrecipient: %s",
00140                      m_nAmount, m_nInterval, m_strSubject, m_strSource, m_strRecipient);
00141
00142     dc << strOutput;
00143 }
00144
00145
00146 /*!
00147     Copies all attributes
00148     \param  standingorder CStandingOrder that should be copied
00149     \return reference to the copied standing order
00150 */
00151 CStandingOrder& CStandingOrder::operator = (const CStandingOrder& standingorder)
00152 {
00153     // copy inherited attributes
00154     CForm::operator =(standingorder);
00155
00156     // copy CStandingOrder's attributes
00157     m_nAmount      = standingorder.m_nAmount;
00158     m_nInterval    = standingorder.m_nInterval;
00159     m_strSubject   = standingorder.m_strSubject;
00160     m_strSource    = standingorder.m_strSource;
00161     m_strRecipient = standingorder.m_strRecipient;
00162
00163     return *this;
00164 }
00165
00166
00167 /*!
00168     Copies all attributes for polymorphic behaviour
00169     \param  bankdocument CStandingOrder (casted as CBankDocument) that should be copied
00170     \return reference to the copied form
00171 */
00172 CBankDocument& CStandingOrder::operator = (const CBankDocument& bankdocument)
00173 {
00174     try
00175     {
00176         // copy all attributes
00177         operator =(dynamic_cast<const CStandingOrder&>(bankdocument));
00178     }
00179     catch(...)
00180     {
00181         // invalid class
00182 #ifdef _DEBUG
00183         TRACE("Copy denied because of invalid cast (needed a CStandingOrder)\n");
00184         Dump(afxDump);
00185         bankdocument.Dump(afxDump);
00186 #endif
00187     }
00188
00189     return *this;
00190 }
00191
00192
00193 /*!
00194     Compare attributes (except key) of two standing orders
00195     \param  form CStandingOrder that we compare to
00196     \return true, if all attributes are equal
00197 */
00198 bool CStandingOrder::operator ==(const CStandingOrder& standingorder) const
00199 {
00200     return (CForm::operator ==(standingorder) &&
00201             m_nAmount       == standingorder.m_nAmount &&
00202             m_nInterval     == standingorder.m_nInterval &&
00203             m_strSubject    == standingorder.m_strSubject &&
00204             m_strSource     == standingorder.m_strSource &&
00205             m_strRecipient  == standingorder.m_strRecipient);
00206 }
00207
00208
00209 /*!
00210     Compares all attributes for polymorphic behaviour
00211     \param  bankdocument CStandingOrder (casted as CBankDocument) that should be compared to
00212     \return true, if all attributes are equal
00213 */
00214 bool CStandingOrder::operator ==(const CBankDocument& bankdocument) const
00215 {
00216     try
00217     {
00218         // compare all attributes
00219         return operator ==(dynamic_cast<const CStandingOrder&>(bankdocument));
00220     }
00221     catch(...)
00222     {
00223         // invalid class
00224         TRACE("Comparison denied because of invalid cast\n"
00225               "(needed a CStandingOrder and got %s)\n", bankdocument.GetRuntimeClass()->m_lpszClassName);
00226 #ifdef _DEBUG
00227         Dump(afxDump);
00228         bankdocument.Dump(afxDump);
00229 #endif
00230     }
00231
00232     return false;
00233 }
00234
00235
00236 /*!
00237     Responsible for the generation of a unique key based on the object's attributes
00238     \return CString that contains the key
00239 */
00240 CString CStandingOrder::KeyOf() const
00241 {
00242     CString strKey;
00243     strKey.Format("[%d|%d|%s|%s|%s|%s|%p]", m_nAmount, m_nInterval,
00244                                             m_strSubject, m_strSource, m_strRecipient,
00245                                             CForm::KeyOf(),
00246                                             this);
00247     return strKey;
00248 }
00249
00250
00251 /*!
00252     Get amount
00253     \return amount
00254 */
00255 unsigned int CStandingOrder::GetAmount() const
00256 {
00257     return m_nAmount;
00258 }
00259 /*!
00260     Get interval
00261     \return interval
00262 */
00263 unsigned int CStandingOrder::GetInterval() const
00264 {
00265     return m_nInterval;
00266 }
00267 /*!
00268     Get subject
00269     \return subject
00270 */
00271 CString CStandingOrder::GetSubject() const
00272 {
00273     return m_strSubject;
00274 }
00275 /*!
00276     Get source
00277     \return source
00278 */
00279 CString CStandingOrder::GetSource() const
00280 {
00281     return m_strSource;
00282 }
00283 /*!
00284     Get recipient
00285     \return recipient
00286 */
00287 CString CStandingOrder::GetRecipient() const
00288 {
00289     return m_strRecipient;
00290 }
00291
00292
00293 /*!
00294     Set amount
00295     \param nAmount amount
00296 */
00297 void CStandingOrder::SetAmount(unsigned int nAmount)
00298 {
00299     m_nAmount = nAmount;
00300     // update alteration date
00301     HasChanged();
00302 }
00303 /*!
00304     Set interval
00305     \param nInterval interval
00306 */
00307 void CStandingOrder::SetInterval(unsigned int nInterval)
00308 {
00309     m_nInterval = nInterval;
00310     // update alteration date
00311     HasChanged();
00312 }
00313
00314
00315
00316 // serializable
00317 IMPLEMENT_SERIAL(CStandingOrder, CForm, 1)
00318
00319 }


StandingOrder.h Source File

StandingOrder.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StandingOrder.h
00005     \brief class CStandingOrder (interface)
00006 */
00007
00008 #include "Form.h"
00009 #pragma once
00010
00011 namespace Model
00012 {
00013
00014 //! A standing order
00015 /*!
00016     \author         Stephan Brumme
00017     \date           August 23, 2001
00018
00019     \invariant
00020     \li all CString attributes must be non-empty
00021     \li m_nAmount and m_nInterval must be positive (greater than zero)
00022     \li parent class must be valid
00023 */
00024
00025 //##ModelId=3B863B0200C8
00026 class CStandingOrder : public CForm
00027 {
00028 public:
00029     //! default constructor
00030     //##ModelId=3B863B020147
00031     CStandingOrder();
00032     //! copy constructor
00033     //##ModelId=3B863B020148
00034     CStandingOrder(const CStandingOrder& standingorder);
00035     //! explicitly set attributes
00036     //##ModelId=3B863B020168
00037     CStandingOrder(CString strAuthor, CString strTitle, CString strKey,
00038                    bool    bProved,   bool    bSigned,  CString strFormality,
00039                    unsigned int nAmount, CString strSubject, CString strSource,
00040                    CString strRecipient, unsigned int nInterval);
00041
00042     //! destructor
00043     //##ModelId=3B863B020145
00044     virtual ~CStandingOrder();
00045
00046     //! create a new object
00047     //##ModelId=3B863B020143
00048     virtual CObject* Generate () const;
00049     //! clone this object
00050     //##ModelId=3B863B020141
00051     virtual CObject* GenerateC() const;
00052     //! serialization
00053     //##ModelId=3B863B02013E
00054     virtual void Serialize(CArchive &ar);
00055     //! validate
00056     //##ModelId=3B863B02013C
00057     virtual void AssertValid() const;
00058     //! dump
00059     //##ModelId=3B863B020139
00060     virtual void Dump(CDumpContext& dc) const;
00061
00062     //! copy
00063     //##ModelId=3B863B02010C
00064             CStandingOrder& operator = (const CStandingOrder& standingorder);
00065     //! polymorphic copy
00066     //##ModelId=3B863B020136
00067     virtual CBankDocument& operator = (const CBankDocument& bankdocument);
00068     //! comparison
00069     //##ModelId=3B863B020106
00070             bool            operator ==(const CStandingOrder& standingorder) const;
00071     //! polymorphic comparison
00072     //##ModelId=3B863B020109
00073     virtual bool operator ==(const CBankDocument& bankdocument) const;
00074
00075     //! deliver a unique identifier
00076     //##ModelId=3B863B020104
00077     virtual CString KeyOf() const;
00078
00079     //! get amount
00080     //##ModelId=3B863B020102
00081     unsigned int GetAmount()    const;
00082     //! get interval
00083     //##ModelId=3B863B020100
00084     unsigned int GetInterval()  const;
00085     //! get subject
00086     //##ModelId=3B863B0200FE
00087     CString      GetSubject()   const;
00088     //! get source
00089     //##ModelId=3B863B0200FC
00090     CString      GetSource()    const;
00091     //! get recipient
00092     //##ModelId=3B863B0200FA
00093     CString      GetRecipient() const;
00094
00095     //! set amount
00096     //##ModelId=3B863B0200CC
00097     void SetAmount  (unsigned int nAmount);
00098     //! set interval
00099     //##ModelId=3B863B0200CA
00100     void SetInterval(unsigned int nInterval);
00101
00102
00103 private:
00104     //! amount each term
00105     //##ModelId=3B88C1AD01C6
00106     unsigned int m_nAmount;
00107     //! number of terms
00108     //##ModelId=3B88C1AD01C5
00109     unsigned int m_nInterval;
00110     //! subject to pay for
00111     //##ModelId=3B88C1AD01C4
00112     CString m_strSubject;
00113     //! person who pays
00114     //##ModelId=3B88C1AD01C3
00115     CString m_strSource;
00116     //! person that gets paid
00117     //##ModelId=3B88C1AD01C2
00118     CString m_strRecipient;
00119
00120
00121     DECLARE_SERIAL(CStandingOrder)
00122 };
00123
00124 } // namespace Model


StandingOrderDialog.cpp Source File

StandingOrderDialog.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StandingOrderDialog.cpp
00005     \brief class CStandingOrderDialog (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "PraktikumMFC.h"
00010 #include "StandingOrderDialog.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 namespace View
00019 {
00020
00021 /*!
00022     Initialize all dialog controls and get dialog mode (create or edit CStandingOrder)
00023     \param bInitialize true, if used to create a new CStandingOrder
00024     \param pParent handle of the parent window (not used)
00025 */
00026 CStandingOrderDialog::CStandingOrderDialog(bool bInitialize, CWnd* pParent /*=NULL*/)
00027     : CDialog(CStandingOrderDialog::IDD, pParent)
00028 {
00029     //{{AFX_DATA_INIT(CStandingOrderDialog)
00030     m_bProved = FALSE;
00031     m_bSigned = FALSE;
00032     m_strAlterationDate = _T("");
00033     m_nAmount = 0;
00034     m_strAuthor = _T("");
00035     m_strDateOfFoundation = _T("");
00036     m_strFormality = _T("");
00037     m_nInterval = 0;
00038     m_strKey = _T("");
00039     m_strRecipient = _T("");
00040     m_strSource = _T("");
00041     m_strSubject = _T("");
00042     m_strTitle = _T("");
00043     //}}AFX_DATA_INIT
00044
00045     m_bInitialize = bInitialize;
00046     m_bModified   = false;
00047 }
00048
00049
00050 /*!
00051     Transfer data from the dialog controls to this class' member variables (and vice versa).
00052     Whole code is generated by wizards
00053     \param pDX data exchange object
00054     \see OnOK
00055 */
00056 void CStandingOrderDialog::DoDataExchange(CDataExchange* pDX)
00057 {
00058     CDialog::DoDataExchange(pDX);
00059     //{{AFX_DATA_MAP(CStandingOrderDialog)
00060     DDX_Check(pDX, IDC_CHECK_PROVED, m_bProved);
00061     DDX_Check(pDX, IDC_CHECK_SIGNED, m_bSigned);
00062     DDX_Text(pDX, IDC_EDIT_ALTERATIONDATE, m_strAlterationDate);
00063     DDX_Text(pDX, IDC_EDIT_AMOUNT, m_nAmount);
00064     DDX_Text(pDX, IDC_EDIT_AUTHOR, m_strAuthor);
00065     DDX_Text(pDX, IDC_EDIT_DATEOFFOUNDATION, m_strDateOfFoundation);
00066     DDX_Text(pDX, IDC_EDIT_FORMALITY, m_strFormality);
00067     DDX_Text(pDX, IDC_EDIT_INTERVAL, m_nInterval);
00068     DDX_Text(pDX, IDC_EDIT_KEY, m_strKey);
00069     DDX_Text(pDX, IDC_EDIT_RECIPIENT, m_strRecipient);
00070     DDX_Text(pDX, IDC_EDIT_SOURCE, m_strSource);
00071     DDX_Text(pDX, IDC_EDIT_SUBJECT, m_strSubject);
00072     DDX_Text(pDX, IDC_EDIT_TITLE, m_strTitle);
00073     //}}AFX_DATA_MAP
00074 }
00075
00076
00077
00078 /*!
00079     Enable/disable dialog controls to differ between creation and edit mode
00080     \see CStandingOrderDialog()
00081 */
00082 BOOL CStandingOrderDialog::OnInitDialog()
00083 {
00084     CDialog::OnInitDialog();
00085
00086     // controls are only writeable if used for construction of a new object
00087     if (m_bInitialize)
00088     {
00089         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE    ))->SetReadOnly(FALSE);
00090         ((CEdit*)GetDlgItem(IDC_EDIT_AUTHOR   ))->SetReadOnly(FALSE);
00091         ((CEdit*)GetDlgItem(IDC_EDIT_KEY      ))->SetReadOnly(FALSE);
00092         ((CEdit*)GetDlgItem(IDC_EDIT_FORMALITY))->SetReadOnly(FALSE);
00093         ((CEdit*)GetDlgItem(IDC_EDIT_SOURCE   ))->SetReadOnly(FALSE);
00094         ((CEdit*)GetDlgItem(IDC_EDIT_RECIPIENT))->SetReadOnly(FALSE);
00095         ((CEdit*)GetDlgItem(IDC_EDIT_SUBJECT  ))->SetReadOnly(FALSE);
00096
00097         // set cursor to title edit control
00098         ((CEdit*)GetDlgItem(IDC_EDIT_TITLE ))->SetFocus();
00099
00100         // disallow MFC to change the focus we set
00101         return FALSE;
00102     }
00103
00104     // done, MFC may automatically set focus according to tab order
00105     return TRUE;
00106 }
00107
00108
00109 /*!
00110     Verify control's values and exit if all are valid
00111     \see DoDataExchange
00112 */
00113 void CStandingOrderDialog::OnOK()
00114 {
00115     // data exchange
00116     UpdateData();
00117
00118     // validate m_strTitle
00119     if (m_strTitle.IsEmpty())
00120     {
00121         AfxMessageBox("Bitte geben Sie einen Titel ein.");
00122         return;
00123     }
00124
00125     // validate m_strAuthor
00126     if (m_strAuthor.IsEmpty())
00127     {
00128         AfxMessageBox("Bitte geben Sie einen Bearbeiter ein.");
00129         return;
00130     }
00131
00132     // validate m_strKey
00133     if (m_strKey.IsEmpty())
00134     {
00135         AfxMessageBox("Bitte geben Sie einen Schlüssel ein.");
00136         return;
00137     }
00138
00139     // validate m_strFormality
00140     if (m_strFormality.IsEmpty())
00141     {
00142         AfxMessageBox("Bitte geben Sie eine Formalität ein.");
00143         return;
00144     }
00145
00146     // validate m_strSource
00147     if (m_strSource.IsEmpty())
00148     {
00149         AfxMessageBox("Bitte geben Sie einen Einzahler ein.");
00150         return;
00151     }
00152
00153     // validate m_strRecipient
00154     if (m_strRecipient.IsEmpty())
00155     {
00156         AfxMessageBox("Bitte geben Sie einen Empfänger ein.");
00157         return;
00158     }
00159
00160     // validate m_strSubject
00161     if (m_strSubject.IsEmpty())
00162     {
00163         AfxMessageBox("Bitte geben Sie einen Betreff ein.");
00164         return;
00165     }
00166
00167     // validate m_nAmount
00168     if (m_nAmount <= 0)
00169     {
00170         AfxMessageBox("Bitte geben Sie eine positive Summe ein.");
00171         return;
00172     }
00173
00174     // validate m_nInterval
00175     if (m_nInterval <= 0)
00176     {
00177         AfxMessageBox("Bitte geben Sie einen positiven Intervall ein.");
00178         return;
00179     }
00180
00181     // done
00182     if (m_bModified)
00183         CDialog::OnOK();
00184     else
00185         CDialog::OnCancel();
00186 }
00187
00188 void CStandingOrderDialog::OnChange()
00189 {
00190     m_bModified = true;
00191 }
00192
00193
00194 BEGIN_MESSAGE_MAP(CStandingOrderDialog, CDialog)
00195     //{{AFX_MSG_MAP(CStandingOrderDialog)
00196     ON_BN_CLICKED(IDC_CHECK_PROVED, OnChange)
00197     ON_BN_CLICKED(IDC_CHECK_SIGNED, OnChange)
00198     ON_EN_CHANGE(IDC_EDIT_AMOUNT, OnChange)
00199     ON_EN_CHANGE(IDC_EDIT_INTERVAL, OnChange)
00200     //}}AFX_MSG_MAP
00201 END_MESSAGE_MAP()
00202
00203 } // namespace View


StandingOrderDialog.h Source File

StandingOrderDialog.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StandingOrderDialog.h
00005     \brief class CStandingOrderDialog (interface)
00006 */
00007
00008 #pragma once
00009
00010 namespace View
00011 {
00012
00013 //! A dialog to create/edit CStandingOrder
00014 /*! \author         Stephan Brumme
00015     \date           August 11, 2001
00016
00017     \invariant
00018     \li each CString attribute must be non-empty
00019     \li m_nAmount and m_nInterval must be positive
00020     \li invariant is verified by OnOK
00021 */
00022
00023 //##ModelId=3B863B0502C6
00024 class CStandingOrderDialog : public CDialog
00025 {
00026 public:
00027     //! constructor
00028     CStandingOrderDialog(bool bInitialize = false, CWnd* pParent = NULL);
00029
00030     //{{AFX_DATA(CStandingOrderDialog)
00031     //! ID of the used dialog resource
00032     enum { IDD = IDD_STANDINGORDER };
00033     //! value of "proved" checkbox control
00034     //##ModelId=3B863B050335
00035     BOOL    m_bProved;
00036     //! value of "signed" checkbox control
00037     //##ModelId=3B863B050334
00038     BOOL    m_bSigned;
00039     //! value of "alteration date" control
00040     //##ModelId=3B863B05030D
00041     CString m_strAlterationDate;
00042     //! value of "amount" edit control
00043     //##ModelId=3B863B05030C
00044     int     m_nAmount;
00045     //! value of "author" edit control
00046     //##ModelId=3B863B05030B
00047     CString m_strAuthor;
00048     //! value of "date of foundation"  control
00049     //##ModelId=3B863B05030A
00050     CString m_strDateOfFoundation;
00051     //! value of "formality" edit control
00052     //##ModelId=3B863B050309
00053     CString m_strFormality;
00054     //! value of "interval" edit control
00055     //##ModelId=3B863B050308
00056     int     m_nInterval;
00057     //! value of "key" edit control
00058     //##ModelId=3B863B050307
00059     CString m_strKey;
00060     //! value of "recipient" edit control
00061     //##ModelId=3B863B050306
00062     CString m_strRecipient;
00063     //! value of "source" edit control
00064     //##ModelId=3B863B050305
00065     CString m_strSource;
00066     //! value of "subject" edit control
00067     //##ModelId=3B863B050304
00068     CString m_strSubject;
00069     //! value of "title" edit control
00070     //##ModelId=3B863B050303
00071     CString m_strTitle;
00072     //}}AFX_DATA
00073
00074
00075     //{{AFX_VIRTUAL(CStandingOrderDialog)
00076     protected:
00077     //! data exchange
00078     //##ModelId=3B863B05033B
00079     virtual void DoDataExchange(CDataExchange* pDX);
00080     //}}AFX_VIRTUAL
00081
00082 protected:
00083
00084     //! true, if used to construct a new CStandingOrder (enable more controls)
00085     //##ModelId=3B863B050302
00086     bool m_bInitialize;
00087     //##ModelId=3B863B0502C8
00088     bool m_bModified;
00089     //##ModelId=3B863B05033A
00090     void OnChange();
00091
00092     //{{AFX_MSG(CStandingOrderDialog)
00093     //! initialize dialog controls
00094     //##ModelId=3B863B050338
00095     virtual BOOL OnInitDialog();
00096     //! validate controls and close dialog
00097     //##ModelId=3B863B050336
00098     virtual void OnOK();
00099     //}}AFX_MSG
00100     DECLARE_MESSAGE_MAP()
00101 };
00102
00103 } // namespace View
00104 //{{AFX_INSERT_LOCATION}}


StdAfx.cpp Source File

StdAfx.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StdAfx.cpp
00005     \brief build pre-compiled headers out of MFC default includes
00006 */
00007
00008 #include "stdafx.h"
00009
00010
00011


StdAfx.h Source File

StdAfx.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  StdAfx.h
00005     \brief MFC default includes
00006 */
00007
00008 #pragma once
00009
00010 // don't include rarely used header files
00011 #define VC_EXTRALEAN
00012 // MFC core
00013 #include <afxwin.h>
00014 // CListView
00015 #include <afxcview.h>
00016 // CFileDialog
00017 #include <afxdlgs.h>
00018
00019
00020 /*!
00021     \author         MFC wizard (automatically)
00022     \date           August 21, 2001
00023 */
00024
00025
00026 //{{AFX_INSERT_LOCATION}}


Trace.cpp Source File

Trace.cpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Trace.cpp
00005     \brief class Debug::CTrace (implementation)
00006 */
00007
00008 #include "stdafx.h"
00009 #include "Trace.h"
00010
00011
00012 namespace Debug
00013 {
00014     // default: no dumps
00015     bool CTrace::m_bObjectDump = false;
00016     bool CTrace::m_bParamDump  = false;
00017
00018
00019 /*!
00020     Initial TRACE
00021     \param strMethod name of the calling method
00022     \param pObject   pointer to the calling object
00023     \param pParam    parameter of the calling method (only for dumps)
00024 */
00025 CTrace::CTrace(const char* strMethod, const CObject* pObject, const CObject* pParam)
00026 {
00027     // only compiled in DEBUG build
00028 #ifdef _DEBUG
00029     // copy parameters
00030     m_strMethod = strMethod;
00031     m_pObject   = pObject;
00032
00033     // valid object ?
00034     if (m_pObject)
00035     {
00036         // display classname
00037         TRACE("%s::", m_pObject->GetRuntimeClass()->m_lpszClassName);
00038         // verify object assertions
00039         ASSERT_VALID(m_pObject);
00040
00041         // dump if neccessary
00042         if (m_bObjectDump)
00043             //m_pObject->Dump(afxDump);
00044             TRACE("OBJECT DUMP DISABLED TO AVOID MEMORY OVERFLOW !!!\n");
00045     }
00046
00047     // display method name
00048     TRACE("%s", m_strMethod);
00049
00050     // TRACE and ASSERT parameter
00051     if (pParam)
00052     {
00053         TRACE("(%s)", pParam->GetRuntimeClass()->m_lpszClassName);
00054         ASSERT_VALID(pParam);
00055
00056         // dump if neccessary
00057         if (m_bParamDump)
00058             pParam->Dump(afxDump);
00059     }
00060
00061     TRACE(" entered ...");
00062 #endif
00063 }
00064
00065
00066 /*!
00067     Finishing TRACE and ASSERT
00068 */
00069 CTrace::~CTrace()
00070 {
00071     // only compiled in DEBUG build
00072 #ifdef _DEBUG
00073     TRACE("leaving %s\n", m_strMethod);
00074     if (m_pObject)
00075         ASSERT_VALID(m_pObject);
00076 #endif
00077 }
00078
00079 } // namespace Debug


Trace.h Source File

Trace.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////
00002 //  Softwarebauelemente II, Praktikumsbeleg/MFC
00003
00004 /*! \file  Trace.h
00005     \brief class Debug::CTrace (interface)
00006 */
00007
00008 #pragma once
00009
00010 //! Gathers all Debug information
00011 namespace Debug
00012 {
00013
00014 //! Generic debug info class
00015 /*! \li encapsulates TRACE
00016
00017     \author         Stephan Brumme
00018     \date           August 21, 2001
00019
00020     \invariant
00021     \li (none)
00022 */
00023
00024 //##ModelId=3B863AF80104
00025 class CTrace
00026 {
00027 public:
00028     //! constructor
00029     //##ModelId=3B863AF8013E
00030     CTrace(const char* strMethod, const CObject* pObject = NULL,
00031            const CObject* pParam  = NULL);
00032     //! destructor
00033     //##ModelId=3B863AF8013C
00034     virtual ~CTrace();
00035
00036     //! dump the whole object each time
00037     //##ModelId=3B863AF8013B
00038     static bool m_bObjectDump;
00039     //! dump the parameter in the constructor
00040     //##ModelId=3B863AF8013A
00041     static bool m_bParamDump;
00042
00043 protected:
00044     //! name of the calling method
00045     //##ModelId=3B863AF80139
00046     CString        m_strMethod;
00047     //! calling object
00048     //##ModelId=3B863AF80136
00049     const CObject* m_pObject;
00050 };
00051
00052 }


Member List

Application::CPraktikumMFCApp Member List

This is the complete list of members for Application::CPraktikumMFCApp, including all inherited members.
  • AddDebug(const char *strText) [static]
  • CPraktikumMFCApp()
  • InitInstance() [virtual]
  • IsDebug() [static]
  • m_pDumpDialog [private, static]
  • OnAppAbout()
  • OnHelp()
  • OnShowDebug()
  • OnWWW()
  • ~CPraktikumMFCApp()


Member List

CMyDate Member List

This is the complete list of members for CMyDate, including all inherited members.
  • APRIL enum value
  • AssertValid() const [virtual]
  • AUGUST enum value
  • CMyDate()
  • CMyDate(const CMyDate &date)
  • CMyDate(unsigned int nDay, unsigned int nMonth, unsigned int nYear, unsigned int nHour=0, unsigned int nMinute=0, unsigned int nSecond=0)
  • DECEMBER enum value
  • Dump(CDumpContext &dc) const [virtual]
  • FEBRUARY enum value
  • Format(CString strFormat) const [virtual]
  • GetCurrent(unsigned int &nDay, unsigned int &nMonth, unsigned int &nYear, unsigned int &nHour, unsigned int &nMinute, unsigned int &nSecond) [static]
  • GetDay() const
  • GetHour() const
  • GetMinute() const
  • GetMonth() const
  • GetSecond() const
  • GetYear() const
  • IsLeapYear(unsigned int nYear) [static]
  • JANUARY enum value
  • JULY enum value
  • JUNE enum value
  • KeyOf() const [virtual]
  • m_nDay [private]
  • m_nHour [private]
  • m_nMinute [private]
  • m_nMonth [private]
  • m_nSecond [private]
  • m_nYear [private]
  • MARCH enum value
  • MAY enum value
  • NOVEMBER enum value
  • OCTOBER enum value
  • operator CString() const [virtual]
  • operator CTime() const [virtual]
  • operator=(const CMyDate &date) [virtual]
  • operator=(const CTime &time) [virtual]
  • operator==(const CMyDate &date) const [virtual]
  • SEPTEMBER enum value
  • Serialize(CArchive &ar)
  • SetDay(unsigned int nDay)
  • SetHour(unsigned int nHour)
  • SetMinute(unsigned int nMinute)
  • SetMonth(unsigned int nMonth)
  • SetSecond(unsigned int nSecond)
  • SetYear(unsigned int nYear)
  • ~CMyDate() [virtual]


Member List

Controller::CChildFrame Member List

This is the complete list of members for Controller::CChildFrame, including all inherited members.
  • ActivateFrame(int nCmdShow=-1) [virtual]
  • CChildFrame()
  • m_bActivated [protected]


Member List

Controller::CMainFrame Member List

This is the complete list of members for Controller::CMainFrame, including all inherited members.
  • CMainFrame() [inline]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]


Member List

Debug::CDumpDialog Member List

This is the complete list of members for Debug::CDumpDialog, including all inherited members.
  • CDumpDialog(CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bObjectDump
  • m_bParameterDump
  • m_strDump
  • OnButtonDelete() [protected]
  • OnCancel() [protected, virtual]
  • OnCheckObjectdump() [protected]
  • OnCheckParameterdump() [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Member List

Debug::CFileTrace Member List

This is the complete list of members for Debug::CFileTrace, including all inherited members.
  • autoInit [private, static]
  • CFileTrace() [private]
  • Init() [static]
  • Write(const void *lpBuf, UINT nCount) [private, virtual]


Member List

Debug::CScenario Member List

This is the complete list of members for Debug::CScenario, including all inherited members.
  • Copyequalvalue(CFolder &m_Folder, int nEntry) [static]
  • CopyequalvalueFolder(CFolder &m_Folder) [static]
  • EqualValue(CFolder &m_Folder, int nEntry) [static]
  • Find(CFolder &m_Folder, int nEntry) [static]
  • FindscratchfindFolder(CFolder &m_Folder, int nEntry) [static]
  • Insert(CFolder &m_Folder, int nEntry) [static]
  • InsertcardFolder(CFolder &m_Folder, int nEntry) [static]
  • InsertfindgetcurrentFolder(CFolder &m_Folder, int nEntry) [static]
  • ScratchcardFolder(CFolder &m_Folder, int nEntry) [static]


Member List

Debug::CTrace Member List

This is the complete list of members for Debug::CTrace, including all inherited members.
  • CTrace(const char *strMethod, const CObject *pObject=NULL, const CObject *pParam=NULL)
  • m_bObjectDump [static]
  • m_bParamDump [static]
  • m_pObject [protected]
  • m_strMethod [protected]
  • ~CTrace() [virtual]


Member List

Model::CBankDocument Member List

This is the complete list of members for Model::CBankDocument, including all inherited members.
  • AssertValid() const [virtual]
  • CBankDocument()
  • CBankDocument(const CBankDocument &bankdocument)
  • CBankDocument(CString strAuthor, CString strTitle, CString strKey)
  • Dump(CDumpContext &dc) const [virtual]
  • Equal(const CObject *object) const
  • EqualKey(const CBankDocument &bankdocument) const
  • Generate() const [virtual]
  • GenerateC() const [virtual]
  • GetAuthor() const
  • GetDateOfFoundation() const
  • GetKey() const
  • GetTitle() const
  • KeyOf() const [virtual]
  • m_dtDateOfFoundation [private]
  • m_strAuthor [private]
  • m_strKey [private]
  • m_strTitle [private]
  • operator=(const CBankDocument &bankdocument) [virtual]
  • operator==(const CBankDocument &bankdocument) const [virtual]
  • Serialize(CArchive &ar) [virtual]
  • ~CBankDocument() [virtual]


Member List

Model::CContract Member List

This is the complete list of members for Model::CContract, including all inherited members.
  • AssertValid() const [virtual]
  • CBankDocument()
  • CBankDocument(const CBankDocument &bankdocument)
  • CBankDocument(CString strAuthor, CString strTitle, CString strKey)
  • CContract()
  • CContract(const CContract &contract)
  • CContract(CString strAuthor, CString strTitle, CString strKey, unsigned int nRegistrationNumber, bool bProved, bool bSigned, CString strWording)
  • Dump(CDumpContext &dc) const [virtual]
  • Equal(const CObject *object) const
  • EqualKey(const CBankDocument &bankdocument) const
  • Generate() const [virtual]
  • GenerateC() const [virtual]
  • GetAlterationDate() const
  • GetAuthor() const
  • GetDateOfFoundation() const
  • GetKey() const
  • GetProved() const
  • GetRegistrationNumber() const
  • GetSigned() const
  • GetTitle() const
  • GetWording() const
  • HasChanged() [protected]
  • KeyOf() const [virtual]
  • m_bProved [private]
  • m_bSigned [private]
  • m_dtAlterationDate [private]
  • m_nRegistrationNumber [private]
  • m_strWording [private]
  • operator=(const CContract &contract)
  • operator=(const CBankDocument &bankdocument) [virtual]
  • operator==(const CContract &contract) const
  • operator==(const CBankDocument &bankdocument) const [virtual]
  • Serialize(CArchive &ar) [virtual]
  • SetProved(bool bProved)
  • SetSigned(bool bSigned)
  • SetWording(CString strWording)
  • ~CBankDocument() [virtual]
  • ~CContract() [virtual]


Member List

Model::CFolder Member List

This is the complete list of members for Model::CFolder, including all inherited members.
  • AssertValid() const [virtual]
  • Model::CPolymorphicSet< CBankDocument >::AssertValid() const [virtual]
  • Card() const
  • CFolder()
  • CFolder(const CFolder &folder)
  • CFolder(CString strCustomerInformation)
  • Clone(const CBankDocument *element) const [protected]
  • CPolymorphicSet()
  • CPolymorphicSet(const CPolymorphicSet< CBankDocument > &set)
  • Dump(CDumpContext &dc) const [virtual]
  • Model::CPolymorphicSet< CBankDocument >::Dump(CDumpContext &dc) const [virtual]
  • Equal(const CPolymorphicSet< CBankDocument > *set) const
  • Find(const CBankDocument *element)
  • Generate() const [virtual]
  • GenerateC() const [virtual]
  • GetCurrent() const
  • GetCustomerInformation() const
  • GetDateOfFoundation() const
  • GetFirst()
  • GetNext()
  • Insert(const CBankDocument *element)
  • m_Cursor [protected]
  • m_dtDateOfFoundation [private]
  • m_Set [protected]
  • m_strCustomerInformation [private]
  • operator=(const CFolder &set) [virtual]
  • Model::CPolymorphicSet< CBankDocument >::operator=(const CPolymorphicSet< CBankDocument > &set) [virtual]
  • operator==(const CFolder &set) const [virtual]
  • Model::CPolymorphicSet< CBankDocument >::operator==(const CPolymorphicSet< CBankDocument > &set) const [virtual]
  • Scratch()
  • ScratchAll()
  • Serialize(CArchive &ar) [virtual]
  • Model::CPolymorphicSet< CBankDocument >::Serialize(CArchive &ar) [virtual]
  • SetCursor(int nIndex)
  • ~CFolder() [virtual]
  • ~CPolymorphicSet() [virtual]


Member List

Model::CForm Member List

This is the complete list of members for Model::CForm, including all inherited members.
  • AssertValid() const [virtual]
  • CBankDocument()
  • CBankDocument(const CBankDocument &bankdocument)
  • CBankDocument(CString strAuthor, CString strTitle, CString strKey)
  • CForm()
  • CForm(const CForm &form)
  • CForm(CString strAuthor, CString strTitle, CString strKey, bool bProved, bool bSigned, CString strFormality)
  • Dump(CDumpContext &dc) const [virtual]
  • Equal(const CObject *object) const
  • EqualKey(const CBankDocument &bankdocument) const
  • Generate() const [virtual]
  • GenerateC() const [virtual]
  • GetAlterationDate() const
  • GetAuthor() const
  • GetDateOfFoundation() const
  • GetFormality() const
  • GetKey() const
  • GetProved() const
  • GetSigned() const
  • GetTitle() const
  • HasChanged() [protected]
  • KeyOf() const [virtual]
  • m_bProved [private]
  • m_bSigned [private]
  • m_dtAlterationDate [private]
  • m_strFormality [private]
  • operator=(const CForm &form)
  • operator=(const CBankDocument &bankdocument) [virtual]
  • operator==(const CForm &form) const
  • operator==(const CBankDocument &bankdocument) const [virtual]
  • Serialize(CArchive &ar) [virtual]
  • SetProved(bool bProved)
  • SetSigned(bool bSigned)
  • ~CBankDocument() [virtual]
  • ~CForm() [virtual]


Member List

Model::CPolymorphicSet Member List

This is the complete list of members for Model::CPolymorphicSet, including all inherited members.
  • AssertValid() const [virtual]
  • Card() const
  • Clone(const C *element) const [protected]
  • CPolymorphicSet()
  • CPolymorphicSet(const CPolymorphicSet< C > &set)
  • Dump(CDumpContext &dc) const [virtual]
  • Equal(const CPolymorphicSet< C > *set) const
  • Find(const C *element)
  • GetCurrent() const
  • GetFirst()
  • GetNext()
  • Insert(const C *element)
  • m_Cursor [protected]
  • m_Set [protected]
  • operator=(const CPolymorphicSet< C > &set) [virtual]
  • operator==(const CPolymorphicSet< C > &set) const [virtual]
  • Scratch()
  • ScratchAll()
  • Serialize(CArchive &ar) [virtual]
  • SetCursor(int nIndex)
  • ~CPolymorphicSet() [virtual]


Member List

Model::CPraktikumMFCDoc Member List

This is the complete list of members for Model::CPraktikumMFCDoc, including all inherited members.
  • CPraktikumMFCDoc() [protected]
  • DeleteAll()
  • DeleteContents() [virtual]
  • DeleteEntry(int nEntry)
  • EditEntry(int nEntry)
  • InsertBankdocument()
  • InsertContract()
  • InsertForm()
  • InsertStandingorder()
  • m_Folder
  • OnNewDocument() [virtual]
  • Serialize(CArchive &ar) [virtual]
  • ShowCustomerinformation() const
  • ~CPraktikumMFCDoc() [protected]


Member List

Model::CStandingOrder Member List

This is the complete list of members for Model::CStandingOrder, including all inherited members.
  • AssertValid() const [virtual]
  • CBankDocument()
  • CBankDocument(const CBankDocument &bankdocument)
  • CBankDocument(CString strAuthor, CString strTitle, CString strKey)
  • CForm()
  • CForm(const CForm &form)
  • CForm(CString strAuthor, CString strTitle, CString strKey, bool bProved, bool bSigned, CString strFormality)
  • CStandingOrder()
  • CStandingOrder(const CStandingOrder &standingorder)
  • CStandingOrder(CString strAuthor, CString strTitle, CString strKey, bool bProved, bool bSigned, CString strFormality, unsigned int nAmount, CString strSubject, CString strSource, CString strRecipient, unsigned int nInterval)
  • Dump(CDumpContext &dc) const [virtual]
  • Equal(const CObject *object) const
  • EqualKey(const CBankDocument &bankdocument) const
  • Generate() const [virtual]
  • GenerateC() const [virtual]
  • GetAlterationDate() const
  • GetAmount() const
  • GetAuthor() const
  • GetDateOfFoundation() const
  • GetFormality() const
  • GetInterval() const
  • GetKey() const
  • GetProved() const
  • GetRecipient() const
  • GetSigned() const
  • GetSource() const
  • GetSubject() const
  • GetTitle() const
  • HasChanged() [protected]
  • KeyOf() const [virtual]
  • m_nAmount [private]
  • m_nInterval [private]
  • m_strRecipient [private]
  • m_strSource [private]
  • m_strSubject [private]
  • operator=(const CStandingOrder &standingorder)
  • operator=(const CBankDocument &bankdocument) [virtual]
  • Model::CForm::operator=(const CForm &form)
  • operator==(const CStandingOrder &standingorder) const
  • operator==(const CBankDocument &bankdocument) const [virtual]
  • Model::CForm::operator==(const CForm &form) const
  • Serialize(CArchive &ar) [virtual]
  • SetAmount(unsigned int nAmount)
  • SetInterval(unsigned int nInterval)
  • SetProved(bool bProved)
  • SetSigned(bool bSigned)
  • ~CBankDocument() [virtual]
  • ~CForm() [virtual]
  • ~CStandingOrder() [virtual]


Member List

View::CAboutDialog Member List

This is the complete list of members for View::CAboutDialog, including all inherited members.
  • CAboutDialog()
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value


Member List

View::CBankDocumentDialog Member List

This is the complete list of members for View::CBankDocumentDialog, including all inherited members.
  • CBankDocumentDialog(bool bInitialize=false, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bInitialize [protected]
  • m_strAuthor
  • m_strDateOfFoundation
  • m_strKey
  • m_strTitle
  • OnChange() [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Member List

View::CContractDialog Member List

This is the complete list of members for View::CContractDialog, including all inherited members.
  • CContractDialog(bool bInitialize=false, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bInitialize [protected]
  • m_bModified [protected]
  • m_bProved
  • m_bSigned
  • m_nRegistrationNumber
  • m_strAlterationDate
  • m_strAuthor
  • m_strDateOfFoundation
  • m_strKey
  • m_strTitle
  • m_strWording
  • OnChange() [protected]
  • OnChangea() [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Member List

View::CFolderDialog Member List

This is the complete list of members for View::CFolderDialog, including all inherited members.
  • CFolderDialog(bool bInitialize=false, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bInitialize [protected]
  • m_nCardinality
  • m_strCustomerInformation
  • m_strDateOfFoundation
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Member List

View::CFormDialog Member List

This is the complete list of members for View::CFormDialog, including all inherited members.
  • CFormDialog(bool bInitialize=false, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bInitialize [protected]
  • m_bModified [protected]
  • m_bProved
  • m_bSigned
  • m_strAlterationDate
  • m_strAuthor
  • m_strDateOfFoundation
  • m_strFormality
  • m_strKey
  • m_strTitle
  • OnChange() [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Member List

View::CPraktikumMFCView Member List

This is the complete list of members for View::CPraktikumMFCView, including all inherited members.
  • CPraktikumMFCView() [inline, protected]
  • GetDocument() [inline]
  • OnContextMenu(CWnd *pWnd, CPoint point) [protected]
  • OnCreate(LPCREATESTRUCT lpCreateStruct) [protected]
  • OnDblclk(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnDeleteAll() [protected]
  • OnDeleteCursor() [protected]
  • OnDraw(CDC *pDC) [virtual]
  • OnInsertBankdocument() [protected]
  • OnInsertContract() [protected]
  • OnInsertForm() [protected]
  • OnInsertStandingorder() [protected]
  • OnPressedReturn(NMHDR *pNMHDR, LRESULT *pResult) [protected]
  • OnScenarioCopyequalvalue() [protected]
  • OnScenarioCopyequalvalueFolder() [protected]
  • OnScenarioEqualValue() [protected]
  • OnScenarioFind() [protected]
  • OnScenarioFindscratchfindFolder() [protected]
  • OnScenarioInsert() [protected]
  • OnScenarioInsertcardFolder() [protected]
  • OnScenarioInsertfindgetcurrentFolder() [protected]
  • OnScenarioScratchcardFolder() [protected]
  • OnShowCursor() [protected]
  • OnShowCustomerinformation() [protected]
  • OnShowDebug() [protected]
  • OnShowDebugCurrent() [protected]
  • OnUpdate(CView *pSender, LPARAM lHint, CObject *pHint) [protected, virtual]
  • OnUpdateDeleteAll(CCmdUI *pCmdUI) [protected]
  • OnUpdateDeleteCursor(CCmdUI *pCmdUI) [protected]
  • OnUpdateScenario(CCmdUI *pCmdUI) [protected]
  • OnUpdateShowCursor(CCmdUI *pCmdUI) [protected]
  • OnUpdateShowDebug(CCmdUI *pCmdUI) [protected]
  • OnUpdateWindowDebug(CCmdUI *pCmdUI) [protected]
  • OnWindowDebug() [protected]
  • PreCreateWindow(CREATESTRUCT &cs) [virtual]


Member List

View::CStandingOrderDialog Member List

This is the complete list of members for View::CStandingOrderDialog, including all inherited members.
  • CStandingOrderDialog(bool bInitialize=false, CWnd *pParent=NULL)
  • DoDataExchange(CDataExchange *pDX) [protected, virtual]
  • IDD enum value
  • m_bInitialize [protected]
  • m_bModified [protected]
  • m_bProved
  • m_bSigned
  • m_nAmount
  • m_nInterval
  • m_strAlterationDate
  • m_strAuthor
  • m_strDateOfFoundation
  • m_strFormality
  • m_strKey
  • m_strRecipient
  • m_strSource
  • m_strSubject
  • m_strTitle
  • OnChange() [protected]
  • OnInitDialog() [protected, virtual]
  • OnOK() [protected, virtual]


Alphabetical index

Praktikum MFC Compound Index

C
CListView
CAboutDialog (View) CMainFrame (Controller)
CBankDocument (Model) CMDIChildWnd
CBankDocumentDialog (View) CMDIFrameWnd
CChildFrame (Controller) CMyDate
CContract (Model) CObject
CContractDialog (View) CPolymorphicSet (Model)
CDialog CPraktikumMFCApp (Application)
CDocument CPraktikumMFCDoc (Model)
CDumpDialog (Debug) CPraktikumMFCView (View)
CFile CScenario (Debug)
CFileTrace (Debug) CStandingOrder (Model)
CFolder (Model) CStandingOrderDialog (View)
CFolderDialog (View) CTrace (Debug)
CForm (Model) CWinApp
CFormDialog (View)


resource.h Source File

resource.h

Go to the documentation of this file.
00001 //{{NO_DEPENDENCIES}}
00002 // Microsoft Developer Studio generated include file.
00003 // Used by PraktikumMFC.rc
00004 //
00005 #define IDD_ABOUTBOX                    100
00006 #define IDR_MAINFRAME                   128
00007 #define IDR_PRAKTITYPE                  129
00008 #define IDD_FOLDER                      131
00009 #define IDD_BANKDOCUMENT                132
00010 #define IDD_FORM                        134
00011 #define IDD_STANDINGORDER               135
00012 #define IDD_CONTRACT                    136
00013 #define IDR_CONTEXTMENU                 137
00014 #define IDD_DEBUG                       138
00015 #define IDC_EDIT_CUSTOMERINFORMATION    1001
00016 #define IDC_EDIT_DATEOFFOUNDATION       1002
00017 #define IDC_EDIT_CARDINALITY            1003
00018 #define IDC_EDIT_TITLE                  1004
00019 #define IDC_EDIT_AUTHOR                 1005
00020 #define IDC_EDIT_KEY                    1006
00021 #define IDC_CHECK_PROVED                1009
00022 #define IDC_CHECK_SIGNED                1010
00023 #define IDC_EDIT_FORMALITY              1011
00024 #define IDC_EDIT_AMOUNT                 1013
00025 #define IDC_EDIT_SUBJECT                1014
00026 #define IDC_EDIT_INTERVAL               1016
00027 #define IDC_EDIT_SOURCE                 1017
00028 #define IDC_EDIT_RECIPIENT              1018
00029 #define IDC_EDIT_ALTERNATIONDATE        1019
00030 #define IDC_EDIT_WORDING                1020
00031 #define IDC_EDIT_REGISTRATIONNUMBER     1021
00032 #define IDC_EDIT_ALTERATIONDATE         1023
00033 #define IDC_EDIT_DUMP                   1026
00034 #define IDC_BUTTON_DELETE               1027
00035 #define IDC_CHECK_OBJECTDUMP            1029
00036 #define IDC_CHECK_PARAMETERDUMP         1030
00037 #define ID_SHOW_CUSTOMERINFORMATION     32771
00038 #define ID_INSERT_BANKDOCUMENT          32775
00039 #define ID_INSERT_FORM                  32776
00040 #define ID_INSERT_STANDINGORDER         32777
00041 #define ID_INSERT_CONTRACT              32778
00042 #define ID_SHOW_CURSOR                  32783
00043 #define ID_DELETE_ALL                   32784
00044 #define ID_DELETE_CURSOR                32785
00045 #define ID_WWW                          32788
00046 #define ID_SHOW_DEBUG                   32795
00047 #define ID_WINDOW_DEBUG                 32797
00048 #define ID_SCENARIO_COPYEQUALVALUE      32800
00049 #define ID_SCENARIO_FIND                32802
00050 #define ID_SCENARIO_INSERT              32803
00051 #define ID_SCENARIO_COPYEQUALVALUE_FOLDER 32804
00052 #define ID_SCENARIO_INSERTFINDGETCURRENT_FOLDER 32805
00053 #define ID_SCENARIO_FINDSCRATCHFIND_FOLDER 32806
00054 #define ID_SCENARIO_INSERTCARD_FOLDER   32807
00055 #define ID_SCENARIO_SCRATCHCARD_FOLDER  32808
00056 #define ID_SHOW_DEBUG_CURRENT           32809
00057 #define ID_SCENARIO_EQUALVALUE          32811
00058
00059 // Next default values for new objects
00060 //
00061 #ifdef APSTUDIO_INVOKED
00062 #ifndef APSTUDIO_READONLY_SYMBOLS
00063 #define _APS_3D_CONTROLS                     1
00064 #define _APS_NEXT_RESOURCE_VALUE        140
00065 #define _APS_NEXT_COMMAND_VALUE         32812
00066 #define _APS_NEXT_CONTROL_VALUE         1031
00067 #define _APS_NEXT_SYMED_VALUE           101
00068 #endif
00069 #endif