1 ///////////////////////////////////////////////////////////
2 // Softwarebauelemente II, Aufgabe O3.2
3 //
4 // author: Stephan Brumme
5 // last changes: May 29, 2001
6
7 #if !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
8 #define AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_
9
10
11 #if _MSC_VER > 1000
12 #pragma once
13 #endif // _MSC_VER > 1000
14
15
16 // STL's list container
17 #include <list>
18
19 // CRoom used as member variable
20 #include "Room.h"
21 // CDate used as member variable
22 #include "Date.h"
23
24
25 class CHouse : public CBasicClass
{
26 // define new types for using the set
27 typedef list<CRoom> TSetOfRooms;
28 typedef TSetOfRooms::iterator TSetCursor;
29 typedef TSetOfRooms::const_iterator TSetConstCursor;
30
31 public:
32 // constructs a new house using its date of foundation (default: today)
33 CHouse();
34 CHouse(const CHouse& house);
35 CHouse(const CDate& dtDateOfFoundation);
36
37 // return class name
38 virtual string ClassnameOf() const { return "CHouse"; }
39
40 // display the attributes
41 virtual string Show() const;
42 // only for internal purposes !
43 virtual string ShowDebug() const;
44
45 // validate a house
46 virtual bool ClassInvariant() const;
47
48 // compare two houses
49 bool operator==(const CHouse& house) const;
50 virtual bool EqualValue(const CBasicClass* pClass) const;
51
52 // copy one house to another one
53 CHouse& operator=(const CHouse &house);
54 virtual bool Copy(const CBasicClass* pClass);
55
56 // return date of foundation
57 CDate GetDateOfFoundation() const;
58 // return number of stored rooms
59 int Card() const;
60
61 // insert a new room into the set, TRUE if successful
62 // will fail if room already exists
63 bool Insert(const CRoom& room);
64 // return first stored room, TRUE if successful
65 bool GetFirst(CRoom& room);
66 // return next room, TRUE if successful
67 bool GetNext(CRoom& room);
68 // look for a room and set cursor, TRUE if successful
69 bool Find(const CRoom& room);
70 // return the room the cursor points to, TRUE if successful
71 bool GetCurrent(CRoom& room) const;
72 // erase current room, TRUE if successful
73 bool Scratch();
74
75 private:
76 CDate m_dtDateOfFoundation;
77
78 TSetOfRooms m_Set;
79 TSetCursor m_itCursor;
80 };
81
82 #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
83
84