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