/////////////////////////////////////////////////////////// // Softwarebauelemente II, Aufgabe O3.1 // // author: Stephan Brumme // last changes: May 15, 2001 #if !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_) #define AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // STL's list container #include // CRoom used as member variable #include "Room.h" // CDate used as member variable #include "Date.h" class CHouse : public CBasicClass { // define new types for using the set typedef list TSetOfRooms; typedef TSetOfRooms::iterator TSetCursor; typedef TSetOfRooms::const_iterator TSetConstCursor; public: // constructs a new house using its date of foundation (default: today) CHouse(); CHouse(const CHouse& house); CHouse(const CDate& dtDateOfFoundation); // return class name virtual string ClassnameOf() const { return "CHouse"; } // display the attributes virtual string Show() const; // only for internal purposes ! virtual string ShowDebug() const; // validate a house virtual bool ClassInvariant() const; // compare two houses bool operator==(const CHouse& house) const; virtual bool EqualValue(const CBasicClass* pClass) const; // copy one house to another one CHouse& operator=(const CHouse &house); virtual bool Copy(const CBasicClass* pClass); // return date of foundation CDate GetDateOfFoundation() const; // return number of stored rooms int Card() const; // insert a new room into the set, TRUE if successful // will fail if room already exists bool Insert(const CRoom& room); // return first stored room, TRUE if successful bool GetFirst(CRoom& room); // return next room, TRUE if successful bool GetNext(CRoom& room); // look for a room and set cursor, TRUE if successful bool Find(const CRoom& room); // return the room the cursor points to, TRUE if successful bool GetCurrent(CRoom& room) const; // erase current room, TRUE if successful bool Scratch(); private: CDate m_dtDateOfFoundation; TSetOfRooms m_Set; TSetCursor m_itCursor; }; #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)